saherPervaiz commited on
Commit
6cd3ef0
·
verified ·
1 Parent(s): 01ec88d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -57,7 +57,7 @@ def chatbot_interface():
57
  elif len(st.session_state.messages) == 3:
58
  self_esteem = int(user_input)
59
  st.session_state.user_data['self_esteem'] = self_esteem
60
- st.session_state.messages.append({"role": "bot", "content": f"Got it! Your self-esteem level is {self_esteem}. How would you describe your mental health history?"})
61
  elif len(st.session_state.messages) == 4:
62
  st.session_state.user_data['mental_health_history'] = user_input
63
  st.session_state.messages.append({"role": "bot", "content": "Thanks! Now, on a scale of 0 to 2, how would you rate your stress level?"})
@@ -79,7 +79,17 @@ def chatbot_interface():
79
  st.markdown(f"**You**: {message['content']}")
80
 
81
  # User input field for chat interaction
82
- user_input = st.text_input("Your message:", "")
 
 
 
 
 
 
 
 
 
 
83
  if user_input:
84
  next_step(user_input)
85
 
 
57
  elif len(st.session_state.messages) == 3:
58
  self_esteem = int(user_input)
59
  st.session_state.user_data['self_esteem'] = self_esteem
60
+ st.session_state.messages.append({"role": "bot", "content": f"Got it! Your self-esteem level is {self_esteem}. Please select your mental health history from the options below."})
61
  elif len(st.session_state.messages) == 4:
62
  st.session_state.user_data['mental_health_history'] = user_input
63
  st.session_state.messages.append({"role": "bot", "content": "Thanks! Now, on a scale of 0 to 2, how would you rate your stress level?"})
 
79
  st.markdown(f"**You**: {message['content']}")
80
 
81
  # User input field for chat interaction
82
+ user_input = ""
83
+ if len(st.session_state.messages) == 3:
84
+ # Mental health history (checkbox options)
85
+ mental_health_options = ["None", "Minor Issues", "Moderate Issues", "Severe Issues"]
86
+ mental_health_history = st.multiselect("Select your mental health history:", mental_health_options)
87
+ if mental_health_history:
88
+ user_input = ", ".join(mental_health_history)
89
+ elif len(st.session_state.messages) == 4:
90
+ # Stress level (radio button)
91
+ user_input = st.radio("On a scale of 0 to 2, how would you rate your stress level?", [0, 1, 2])
92
+
93
  if user_input:
94
  next_step(user_input)
95