Update app.py
Browse files
app.py
CHANGED
|
@@ -1,13 +1,28 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
def mental_health_bot(user_input):
|
| 4 |
-
#
|
| 5 |
if "sad" in user_input.lower():
|
| 6 |
-
return "I'm sorry to hear that.
|
| 7 |
elif "happy" in user_input.lower():
|
| 8 |
return "That's great to hear! Keep smiling!"
|
| 9 |
-
|
| 10 |
-
return "How can I help you today?"
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
def mental_health_bot(user_input):
|
| 4 |
+
# Replace with your actual logic
|
| 5 |
if "sad" in user_input.lower():
|
| 6 |
+
return "I'm sorry to hear that. I'm here to help."
|
| 7 |
elif "happy" in user_input.lower():
|
| 8 |
return "That's great to hear! Keep smiling!"
|
| 9 |
+
return "How can I help you today?"
|
|
|
|
| 10 |
|
| 11 |
+
with gr.Blocks() as demo:
|
| 12 |
+
gr.Markdown("### 🧠 Mental Health Support App")
|
| 13 |
+
|
| 14 |
+
with gr.Row():
|
| 15 |
+
user_input = gr.Textbox(label="Enter your question or feelings", placeholder="Type something...", lines=2)
|
| 16 |
+
|
| 17 |
+
with gr.Row():
|
| 18 |
+
submit_btn = gr.Button("Submit", elem_id="submit-btn")
|
| 19 |
+
clear_btn = gr.Button("Clear")
|
| 20 |
+
|
| 21 |
+
with gr.Row():
|
| 22 |
+
output = gr.Textbox(label="Response", placeholder="Your response will appear here", lines=2)
|
| 23 |
+
|
| 24 |
+
submit_btn.click(mental_health_bot, inputs=[user_input], outputs=[output])
|
| 25 |
+
clear_btn.click(lambda: ("", ""), inputs=[], outputs=[user_input, output])
|
| 26 |
+
|
| 27 |
+
# Styling
|
| 28 |
+
demo.launch()
|