lokesh341 commited on
Commit
36fac98
·
verified ·
1 Parent(s): f79ef70

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -6
app.py CHANGED
@@ -1,13 +1,28 @@
1
  import gradio as gr
2
 
3
  def mental_health_bot(user_input):
4
- # Example logic: Replace this with your model's predictions
5
  if "sad" in user_input.lower():
6
- return "I'm sorry to hear that. Please take care of yourself."
7
  elif "happy" in user_input.lower():
8
  return "That's great to hear! Keep smiling!"
9
- else:
10
- return "How can I help you today?"
11
 
12
- interface = gr.Interface(fn=mental_health_bot, inputs="text", outputs="text")
13
- interface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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()