Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -356,7 +356,6 @@ with gr.Blocks(css=custom_css) as app:
|
|
356 |
|
357 |
submit_chatbot = gr.Button(value="Submit Your Message", variant="primary", elem_id="submit-chatbot", icon="fa-paper-plane")
|
358 |
|
359 |
-
# Adding the loading prop for the chatbot button
|
360 |
chatbot = gr.Chatbot(label="Chat History", elem_id="chat-history", show_label=True)
|
361 |
sentiment = gr.Textbox(label="Detected Sentiment")
|
362 |
emotion = gr.Textbox(label="Detected Emotion")
|
@@ -365,13 +364,13 @@ with gr.Blocks(css=custom_css) as app:
|
|
365 |
professionals = gr.DataFrame(label="Nearby Health Professionals", headers=["Name", "Address"])
|
366 |
map_html = gr.HTML(label="Interactive Map")
|
367 |
|
|
|
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 |
-
|
373 |
-
|
374 |
-
|
375 |
with gr.Tab("Disease Prediction"):
|
376 |
symptom1 = gr.Dropdown(X_train.columns.tolist(), label="Select Symptom 1")
|
377 |
symptom2 = gr.Dropdown(X_train.columns.tolist(), label="Select Symptom 2")
|
@@ -381,16 +380,14 @@ with gr.Blocks(css=custom_css) as app:
|
|
381 |
|
382 |
submit_disease = gr.Button(value="Predict Disease", variant="primary", icon="fa-stethoscope")
|
383 |
|
384 |
-
# Adding the loading prop for the disease prediction button
|
385 |
disease_prediction_result = gr.Markdown(label="Predicted Diseases") # Use Markdown for predictions
|
386 |
|
387 |
submit_disease.click(
|
388 |
lambda symptom1, symptom2, symptom3, symptom4, symptom5: predict_disease(
|
389 |
[symptom1, symptom2, symptom3, symptom4, symptom5]),
|
390 |
inputs=[symptom1, symptom2, symptom3, symptom4, symptom5],
|
391 |
-
outputs=disease_prediction_result
|
392 |
-
|
393 |
-
)
|
394 |
|
395 |
# Launch the Gradio application
|
396 |
app.launch()
|
|
|
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")
|
|
|
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")
|
376 |
symptom2 = gr.Dropdown(X_train.columns.tolist(), label="Select Symptom 2")
|
|
|
380 |
|
381 |
submit_disease = gr.Button(value="Predict Disease", variant="primary", icon="fa-stethoscope")
|
382 |
|
|
|
383 |
disease_prediction_result = gr.Markdown(label="Predicted Diseases") # Use Markdown for predictions
|
384 |
|
385 |
submit_disease.click(
|
386 |
lambda symptom1, symptom2, symptom3, symptom4, symptom5: predict_disease(
|
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()
|