DreamStream-1 commited on
Commit
a4d2f95
·
verified ·
1 Parent(s): d2863d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -47
app.py CHANGED
@@ -258,8 +258,6 @@ custom_css = """
258
  body {
259
  font-family: 'Arial', sans-serif;
260
  background-color: #f0f4f7; /* Light background for better contrast */
261
- margin: 0;
262
- padding: 0;
263
  }
264
 
265
  h1 {
@@ -286,9 +284,6 @@ textarea, input {
286
  color: white;
287
  border-radius: 8px;
288
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2); /* Shadow on button */
289
- display: flex;
290
- align-items: center;
291
- justify-content: center;
292
  }
293
 
294
  .gr-button:hover {
@@ -299,10 +294,6 @@ textarea, input {
299
  background-color: #7f156b; /* Even darker shade on active */
300
  }
301
 
302
- .gr-button .fa {
303
- margin-right: 10px;
304
- }
305
-
306
  .df-container {
307
  background: white;
308
  color: black;
@@ -315,61 +306,33 @@ textarea, input {
315
  overflow-y: auto;
316
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); /* Light shadow for data frame */
317
  }
318
-
319
- @media (max-width: 768px) {
320
- h1 {
321
- font-size: 1.5rem;
322
- padding: 10px;
323
- }
324
-
325
- .gr-button {
326
- font-size: 0.9rem;
327
- padding: 10px;
328
- }
329
-
330
- .gr-row {
331
- flex-direction: column;
332
- align-items: center;
333
- }
334
-
335
- textarea, input {
336
- width: 100%;
337
- margin-bottom: 10px;
338
- }
339
-
340
- .gr-chatbot {
341
- max-height: 300px;
342
- overflow-y: auto;
343
- }
344
- }
345
  """
346
 
347
  # Gradio Application Interface
348
  with gr.Blocks(css=custom_css) as app:
349
- gr.HTML("<h1>🌟 Well-Being For All </h1>")
350
 
351
- with gr.Tab("Well-Being Chatbot"):
352
  with gr.Row():
353
  user_input = gr.Textbox(label="Please Enter Your Message Here", placeholder="Type your message here...", max_lines=3)
354
- location = gr.Textbox(label="Please Enter Your Current Location Here", placeholder="E.g., New York", max_lines=1)
355
- query = gr.Textbox(label="Please Enter Which Health Professional You Want To Search Nearby", placeholder="E.g., therapist", max_lines=1)
356
 
357
  submit_chatbot = gr.Button(value="Submit Your Message", variant="primary", elem_id="submit-chatbot", icon="fa-paper-plane")
358
 
359
- chatbot = gr.Chatbot(label="Chat History", elem_id="chat-history", show_label=True)
360
- sentiment = gr.Textbox(label="Detected Sentiment")
361
- emotion = gr.Textbox(label="Detected Emotion")
362
 
363
  suggestions_markdown = gr.Markdown(label="Suggestions") # Markdown for displaying suggestions
364
  professionals = gr.DataFrame(label="Nearby Health Professionals", headers=["Name", "Address"])
365
  map_html = gr.HTML(label="Interactive Map")
366
 
367
- # Here we add the loading state on the button itself
368
  submit_chatbot.click(
369
  app_function_chatbot,
370
  inputs=[user_input, location, query, chatbot],
371
- outputs=[chatbot, sentiment, emotion, suggestions_markdown, professionals, map_html]
372
- ).then(submit_chatbot.update(loading=True))
373
 
374
  with gr.Tab("Disease Prediction"):
375
  symptom1 = gr.Dropdown(X_train.columns.tolist(), label="Select Symptom 1")
@@ -387,7 +350,7 @@ with gr.Blocks(css=custom_css) as app:
387
  [symptom1, symptom2, symptom3, symptom4, symptom5]),
388
  inputs=[symptom1, symptom2, symptom3, symptom4, symptom5],
389
  outputs=disease_prediction_result
390
- ).then(submit_disease.update(loading=True))
391
 
392
  # Launch the Gradio application
393
  app.launch()
 
258
  body {
259
  font-family: 'Arial', sans-serif;
260
  background-color: #f0f4f7; /* Light background for better contrast */
 
 
261
  }
262
 
263
  h1 {
 
284
  color: white;
285
  border-radius: 8px;
286
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2); /* Shadow on button */
 
 
 
287
  }
288
 
289
  .gr-button:hover {
 
294
  background-color: #7f156b; /* Even darker shade on active */
295
  }
296
 
 
 
 
 
297
  .df-container {
298
  background: white;
299
  color: black;
 
306
  overflow-y: auto;
307
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); /* Light shadow for data frame */
308
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
309
  """
310
 
311
  # Gradio Application Interface
312
  with gr.Blocks(css=custom_css) as app:
313
+ gr.HTML("<h1>🌟 Well-Being Companion</h1>")
314
 
315
+ with gr.Tab("Mental Health Chatbot"):
316
  with gr.Row():
317
  user_input = gr.Textbox(label="Please Enter Your Message Here", placeholder="Type your message here...", max_lines=3)
318
+ location = gr.Textbox(label="Please Enter Your Current Location Here", placeholder="E.g., Karachi", max_lines=1)
319
+ query = gr.Textbox(label="Please Enter Which Health Professional You Want To Search Nearby", placeholder="E.g., Doctors", max_lines=1)
320
 
321
  submit_chatbot = gr.Button(value="Submit Your Message", variant="primary", elem_id="submit-chatbot", icon="fa-paper-plane")
322
 
323
+ chatbot = gr.Chatbot(label="Chat History", show_label=False, elem_id="chat-history")
324
+ sentiment = gr.Textbox(label="Detected Sentiment", show_label=False)
325
+ emotion = gr.Textbox(label="Detected Emotion", show_label=False)
326
 
327
  suggestions_markdown = gr.Markdown(label="Suggestions") # Markdown for displaying suggestions
328
  professionals = gr.DataFrame(label="Nearby Health Professionals", headers=["Name", "Address"])
329
  map_html = gr.HTML(label="Interactive Map")
330
 
 
331
  submit_chatbot.click(
332
  app_function_chatbot,
333
  inputs=[user_input, location, query, chatbot],
334
+ outputs=[chatbot, sentiment, emotion, suggestions_markdown, professionals, map_html],
335
+ )
336
 
337
  with gr.Tab("Disease Prediction"):
338
  symptom1 = gr.Dropdown(X_train.columns.tolist(), label="Select Symptom 1")
 
350
  [symptom1, symptom2, symptom3, symptom4, symptom5]),
351
  inputs=[symptom1, symptom2, symptom3, symptom4, symptom5],
352
  outputs=disease_prediction_result
353
+ )
354
 
355
  # Launch the Gradio application
356
  app.launch()