Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -202,9 +202,9 @@ def gradio_app(message, location, health_query, submit_button, history, state):
|
|
| 202 |
return history, "", "", "", "", gr.DataFrame([], headers=["Title", "Subject", "Link"]), state
|
| 203 |
|
| 204 |
# Gradio UI components
|
| 205 |
-
message_input = gr.Textbox(lines=1, label="Message")
|
| 206 |
-
location_input = gr.Textbox(value="Honolulu, HI", label="Current Location")
|
| 207 |
-
health_query_input = gr.Textbox(value="doctor", label="Health Professional Query (e.g., doctor,
|
| 208 |
submit_button = gr.Button("Submit")
|
| 209 |
|
| 210 |
# Updated chat history component with 'messages' type
|
|
@@ -217,6 +217,72 @@ route_info_output = gr.Textbox(label="Health Professionals Information")
|
|
| 217 |
map_output = gr.HTML(label="Map with Health Professionals")
|
| 218 |
suggestions_output = gr.DataFrame(label="Well-Being Suggestions", headers=["Title", "Subject", "Link"])
|
| 219 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
# Create Gradio interface
|
| 221 |
iface = gr.Interface(
|
| 222 |
fn=gradio_app,
|
|
@@ -224,7 +290,8 @@ iface = gr.Interface(
|
|
| 224 |
outputs=[chat_history, sentiment_output, emotion_output, route_info_output, map_output, suggestions_output, gr.State()],
|
| 225 |
allow_flagging="never",
|
| 226 |
live=False,
|
| 227 |
-
title="Well-Being App: Support, Sentiment, Emotion Detection & Health Professional Search"
|
|
|
|
| 228 |
)
|
| 229 |
|
| 230 |
# Launch the Gradio interface
|
|
|
|
| 202 |
return history, "", "", "", "", gr.DataFrame([], headers=["Title", "Subject", "Link"]), state
|
| 203 |
|
| 204 |
# Gradio UI components
|
| 205 |
+
message_input = gr.Textbox(lines=1, label="Message", placeholder="Type your message here...")
|
| 206 |
+
location_input = gr.Textbox(value="Honolulu, HI", label="Current Location", placeholder="Enter your current location...")
|
| 207 |
+
health_query_input = gr.Textbox(value="doctor", label="Health Professional Query (e.g., doctor, health professional, well-being professional", placeholder="Search for health professionals...")
|
| 208 |
submit_button = gr.Button("Submit")
|
| 209 |
|
| 210 |
# Updated chat history component with 'messages' type
|
|
|
|
| 217 |
map_output = gr.HTML(label="Map with Health Professionals")
|
| 218 |
suggestions_output = gr.DataFrame(label="Well-Being Suggestions", headers=["Title", "Subject", "Link"])
|
| 219 |
|
| 220 |
+
# Custom CSS for styling
|
| 221 |
+
custom_css = """
|
| 222 |
+
<style>
|
| 223 |
+
body {
|
| 224 |
+
background-color: #f0f8ff;
|
| 225 |
+
color: #333;
|
| 226 |
+
font-family: Arial, sans-serif;
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
h1, h2, h3, h4, h5, h6 {
|
| 230 |
+
color: #0056b3;
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
.gradio-app {
|
| 234 |
+
max-width: 800px;
|
| 235 |
+
margin: 0 auto;
|
| 236 |
+
padding: 20px;
|
| 237 |
+
background-color: #fff;
|
| 238 |
+
border-radius: 10px;
|
| 239 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
.gradio-input, .gradio-output {
|
| 243 |
+
margin-bottom: 15px;
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
.gradio-button {
|
| 247 |
+
background-color: #0056b3;
|
| 248 |
+
color: #fff;
|
| 249 |
+
border: none;
|
| 250 |
+
padding: 10px 20px;
|
| 251 |
+
border-radius: 5px;
|
| 252 |
+
cursor: pointer;
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
.gradio-button:hover {
|
| 256 |
+
background-color: #004080;
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
.gradio-dataframe {
|
| 260 |
+
border: 1px solid #ddd;
|
| 261 |
+
border-radius: 5px;
|
| 262 |
+
overflow: hidden;
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
.gradio-dataframe th, .gradio-dataframe td {
|
| 266 |
+
padding: 10px;
|
| 267 |
+
text-align: left;
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
.gradio-dataframe th {
|
| 271 |
+
background-color: #0056b3;
|
| 272 |
+
color: #fff;
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
.gradio-dataframe a {
|
| 276 |
+
color: #0056b3;
|
| 277 |
+
text-decoration: none;
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
.gradio-dataframe a:hover {
|
| 281 |
+
text-decoration: underline;
|
| 282 |
+
}
|
| 283 |
+
</style>
|
| 284 |
+
"""
|
| 285 |
+
|
| 286 |
# Create Gradio interface
|
| 287 |
iface = gr.Interface(
|
| 288 |
fn=gradio_app,
|
|
|
|
| 290 |
outputs=[chat_history, sentiment_output, emotion_output, route_info_output, map_output, suggestions_output, gr.State()],
|
| 291 |
allow_flagging="never",
|
| 292 |
live=False,
|
| 293 |
+
title="Well-Being App: Support, Sentiment, Emotion Detection & Health Professional Search",
|
| 294 |
+
css=custom_css
|
| 295 |
)
|
| 296 |
|
| 297 |
# Launch the Gradio interface
|