Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -13,9 +13,12 @@ def load_json_data():
|
|
13 |
with open(DATA_FILE, "r", encoding="utf-8") as f:
|
14 |
data = json.load(f)
|
15 |
|
16 |
-
#
|
17 |
if isinstance(data, list):
|
18 |
-
data = {
|
|
|
|
|
|
|
19 |
|
20 |
return data
|
21 |
except (FileNotFoundError, ValueError) as e:
|
@@ -62,4 +65,4 @@ def chatbot_response(message, history):
|
|
62 |
# 🔹 Gradio Chat Interface
|
63 |
demo = gr.ChatInterface(chatbot_response, textbox=gr.Textbox(placeholder="Ask about Colorado food stamps..."))
|
64 |
|
65 |
-
demo.launch()
|
|
|
13 |
with open(DATA_FILE, "r", encoding="utf-8") as f:
|
14 |
data = json.load(f)
|
15 |
|
16 |
+
# Ensure data is a dictionary, not a list
|
17 |
if isinstance(data, list):
|
18 |
+
data = {str(i): str(entry) for i, entry in enumerate(data)}
|
19 |
+
|
20 |
+
# Convert all values to strings
|
21 |
+
data = {key: str(value) for key, value in data.items()}
|
22 |
|
23 |
return data
|
24 |
except (FileNotFoundError, ValueError) as e:
|
|
|
65 |
# 🔹 Gradio Chat Interface
|
66 |
demo = gr.ChatInterface(chatbot_response, textbox=gr.Textbox(placeholder="Ask about Colorado food stamps..."))
|
67 |
|
68 |
+
demo.launch()
|