Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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.
|
220 |
-
gr.
|
221 |
-
gr.
|
222 |
gr.State(value=[])
|
223 |
],
|
224 |
outputs=[
|
225 |
-
gr.
|
226 |
-
gr.
|
227 |
-
gr.
|
228 |
-
gr.
|
229 |
-
gr.
|
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)
|