DreamStream-1 commited on
Commit
f523b13
·
verified ·
1 Parent(s): dacc7c0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -173,7 +173,9 @@ def search_wellness_professionals(location):
173
  return "No data found."
174
 
175
  # Gradio Interface
176
- def gradio_interface(message, location, history):
 
 
177
  # Stage 1: Mental Health Chatbot
178
  history, _ = chat(message, history)
179
 
@@ -195,14 +197,15 @@ iface = gr.Interface(
195
  inputs=[
196
  gr.Textbox(label="Enter your message", placeholder="How are you feeling today?"),
197
  gr.Textbox(label="Enter your location (e.g., Hawaii, Oahu)", placeholder="Your location"),
198
- "state"
199
  ],
200
  outputs=[
201
  gr.Chatbot(label="Chat History"),
202
  gr.Textbox(label="Sentiment Analysis"),
203
  gr.Textbox(label="Detected Emotion"),
204
  gr.Textbox(label="Suggestions"),
205
- gr.File(label="Download Wellness Professionals CSV")
 
206
  ],
207
  allow_flagging="never",
208
  title="Mental Wellbeing App with AI Assistance",
@@ -212,3 +215,4 @@ iface = gr.Interface(
212
  # Launch Gradio interface
213
  if __name__ == "__main__":
214
  iface.launch(debug=True)
 
 
173
  return "No data found."
174
 
175
  # Gradio Interface
176
+ def gradio_interface(message, location, state):
177
+ history = state or [] # If state is None, initialize it as an empty list
178
+
179
  # Stage 1: Mental Health Chatbot
180
  history, _ = chat(message, history)
181
 
 
197
  inputs=[
198
  gr.Textbox(label="Enter your message", placeholder="How are you feeling today?"),
199
  gr.Textbox(label="Enter your location (e.g., Hawaii, Oahu)", placeholder="Your location"),
200
+ gr.State() # One state input
201
  ],
202
  outputs=[
203
  gr.Chatbot(label="Chat History"),
204
  gr.Textbox(label="Sentiment Analysis"),
205
  gr.Textbox(label="Detected Emotion"),
206
  gr.Textbox(label="Suggestions"),
207
+ gr.File(label="Download Wellness Professionals CSV"),
208
+ gr.State() # One state output
209
  ],
210
  allow_flagging="never",
211
  title="Mental Wellbeing App with AI Assistance",
 
215
  # Launch Gradio interface
216
  if __name__ == "__main__":
217
  iface.launch(debug=True)
218
+