jacktol commited on
Commit
e76dbbb
·
1 Parent(s): ef49a1a

updated ui

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -138,12 +138,13 @@ async def handle_message(message: cl.Message):
138
 
139
  @cl.on_chat_start
140
  async def handle_chat_start():
141
- # Ensure session data is initialized
142
- if "message_history" not in cl.user_session:
143
  cl.user_session.set("message_history", [])
144
-
145
- if "food_data" not in cl.user_session:
146
- cl.user_session.set("food_data", None) # Explicitly initialize to None
 
147
 
148
  welcome_message = """
149
  ## Welcome to the USDA Food Assistant!
@@ -170,7 +171,6 @@ The dataset powering this application is available on HuggingFace Datasets, link
170
  To learn more about how this dataset & the USDA Food Assistant were created, check out the blog post, linked [here](https://jacktol.net/posts/building_a_data_pipeline_for_usda_fooddata_central/).
171
 
172
  The full code for the data pipeline and the assistant can be found on GitHub, linked [here](https://github.com/jack-tol/usda-food-data-pipeline).
173
-
174
  """
175
-
176
  await cl.Message(content=welcome_message).send()
 
138
 
139
  @cl.on_chat_start
140
  async def handle_chat_start():
141
+ # Check if "message_history" is None
142
+ if cl.user_session.get("message_history") is None:
143
  cl.user_session.set("message_history", [])
144
+
145
+ # Check if "food_data" is None
146
+ if cl.user_session.get("food_data") is None:
147
+ cl.user_session.set("food_data", None)
148
 
149
  welcome_message = """
150
  ## Welcome to the USDA Food Assistant!
 
171
  To learn more about how this dataset & the USDA Food Assistant were created, check out the blog post, linked [here](https://jacktol.net/posts/building_a_data_pipeline_for_usda_fooddata_central/).
172
 
173
  The full code for the data pipeline and the assistant can be found on GitHub, linked [here](https://github.com/jack-tol/usda-food-data-pipeline).
 
174
  """
175
+
176
  await cl.Message(content=welcome_message).send()