DreamStream-1 commited on
Commit
2f693ca
·
verified ·
1 Parent(s): 0d12be2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -9
app.py CHANGED
@@ -100,6 +100,7 @@ def detect_emotion(user_input):
100
  result = pipe(user_input)
101
  emotion = result[0]['label']
102
  return f"Emotion Detected: {emotion}"
 
103
  # Initialize Google Maps API client securely
104
  gmaps = googlemaps.Client(key=os.getenv('GOOGLE_API_KEY'))
105
 
@@ -164,6 +165,7 @@ def generate_suggestions(emotion):
164
 
165
  emotion_suggestions = suggestions.get(emotion, [])
166
  return pd.DataFrame(emotion_suggestions)
 
167
  # Custom CSS styling for Gradio interface
168
  css = """
169
  body {
@@ -216,17 +218,17 @@ def gradio_app(message, current_location, health_professional_query, history):
216
  iface = gr.Interface(
217
  fn=gradio_app,
218
  inputs=[
219
- gr.inputs.Textbox(lines=2, placeholder="Enter your message..."),
220
- gr.inputs.Textbox(lines=2, placeholder="Enter your current location..."),
221
- gr.inputs.Textbox(lines=2, placeholder="Enter health professional query..."),
222
  gr.State(value=[])
223
  ],
224
  outputs=[
225
- gr.outputs.Textbox(label="Sentiment Analysis"),
226
- gr.outputs.Textbox(label="Detected Emotion"),
227
- gr.outputs.Dataframe(label="Suggestions"),
228
- gr.outputs.Textbox(label="Nearby Health Professionals"),
229
- gr.outputs.HTML(label="Map of Health Professionals"),
230
  gr.State(value=[])
231
  ],
232
  live=True,
@@ -236,4 +238,4 @@ iface = gr.Interface(
236
  )
237
 
238
  # Launch Gradio interface
239
- iface.launch(share=True)
 
100
  result = pipe(user_input)
101
  emotion = result[0]['label']
102
  return f"Emotion Detected: {emotion}"
103
+
104
  # Initialize Google Maps API client securely
105
  gmaps = googlemaps.Client(key=os.getenv('GOOGLE_API_KEY'))
106
 
 
165
 
166
  emotion_suggestions = suggestions.get(emotion, [])
167
  return pd.DataFrame(emotion_suggestions)
168
+
169
  # Custom CSS styling for Gradio interface
170
  css = """
171
  body {
 
218
  iface = gr.Interface(
219
  fn=gradio_app,
220
  inputs=[
221
+ gr.Textbox(lines=2, placeholder="Enter your message..."),
222
+ gr.Textbox(lines=2, placeholder="Enter your current location..."),
223
+ gr.Textbox(lines=2, placeholder="Enter health professional query..."),
224
  gr.State(value=[])
225
  ],
226
  outputs=[
227
+ gr.Textbox(label="Sentiment Analysis"),
228
+ gr.Textbox(label="Detected Emotion"),
229
+ gr.Dataframe(label="Suggestions"),
230
+ gr.Textbox(label="Nearby Health Professionals"),
231
+ gr.HTML(label="Map of Health Professionals"),
232
  gr.State(value=[])
233
  ],
234
  live=True,
 
238
  )
239
 
240
  # Launch Gradio interface
241
+ iface.launch(share=True)