Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -188,9 +188,13 @@ def generate_suggestions(emotion):
|
|
| 188 |
],
|
| 189 |
}
|
| 190 |
|
| 191 |
-
# Create a markdown string for clickable suggestions
|
| 192 |
-
formatted_suggestions = [
|
| 193 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
]
|
| 195 |
|
| 196 |
return "\n".join(formatted_suggestions)
|
|
@@ -258,7 +262,7 @@ with gr.Blocks() as app:
|
|
| 258 |
sentiment = gr.Textbox(label="Detected Sentiment")
|
| 259 |
emotion = gr.Textbox(label="Detected Emotion")
|
| 260 |
|
| 261 |
-
suggestions_markdown = gr.Markdown(label="Suggestions") #
|
| 262 |
professionals = gr.DataFrame(label="Nearby Health Professionals", headers=["Name", "Address"])
|
| 263 |
map_html = gr.HTML(label="Interactive Map")
|
| 264 |
|
|
|
|
| 188 |
],
|
| 189 |
}
|
| 190 |
|
| 191 |
+
# Create a markdown string for clickable suggestions in a table format
|
| 192 |
+
formatted_suggestions = ["### Suggestions"]
|
| 193 |
+
formatted_suggestions.append(f"Since you’re feeling {emotion}, you might find these links particularly helpful. Don’t hesitate to explore:")
|
| 194 |
+
formatted_suggestions.append("| Title | Link |")
|
| 195 |
+
formatted_suggestions.append("|-------|------|") # Table headers
|
| 196 |
+
formatted_suggestions += [
|
| 197 |
+
f"| [{title}]({link}) | {link} |" for title, link in suggestions.get(emotion_key, [("No specific suggestions available.", "#")])
|
| 198 |
]
|
| 199 |
|
| 200 |
return "\n".join(formatted_suggestions)
|
|
|
|
| 262 |
sentiment = gr.Textbox(label="Detected Sentiment")
|
| 263 |
emotion = gr.Textbox(label="Detected Emotion")
|
| 264 |
|
| 265 |
+
suggestions_markdown = gr.Markdown(label="Suggestions") # Markdown for displaying clickable links
|
| 266 |
professionals = gr.DataFrame(label="Nearby Health Professionals", headers=["Name", "Address"])
|
| 267 |
map_html = gr.HTML(label="Interactive Map")
|
| 268 |
|