Jeet Paul commited on
Commit
757575c
·
1 Parent(s): 68c34d0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -16
app.py CHANGED
@@ -156,26 +156,12 @@ def main():
156
  st.title("Mental Health Chatbot")
157
  st.write("Enter your message and get a response from the chatbot:")
158
 
159
- # Generate a unique conversation key using st.session_state
160
- if 'conversation_key' not in st.session_state:
161
- st.session_state.conversation_key = 0
162
-
163
- conversation_key = st.session_state.conversation_key # Store the key in a variable
164
-
165
- conversation_history = st.text_area("Conversation History:", "", height=200, max_chars=500, key=f"conversation_{conversation_key}")
166
-
167
  user_input = st.text_input("User Input:")
168
 
169
  if st.button("Submit"):
170
  response = get_response(user_input)
171
-
172
- conversation_history += f"You: {user_input}\nBot: {response}\n\n"
173
-
174
- # Use the same key to update the conversation_history
175
- st.text_area("Conversation History:", conversation_history, height=200, max_chars=500, key=f"conversation_{conversation_key}")
176
-
177
- # Increment the conversation_key to make it unique
178
- st.session_state.conversation_key += 1
179
 
180
  if __name__ == '__main__':
181
  main()
 
156
  st.title("Mental Health Chatbot")
157
  st.write("Enter your message and get a response from the chatbot:")
158
 
 
 
 
 
 
 
 
 
159
  user_input = st.text_input("User Input:")
160
 
161
  if st.button("Submit"):
162
  response = get_response(user_input)
163
+ st.write("Bot Response:")
164
+ st.write(response)
 
 
 
 
 
 
165
 
166
  if __name__ == '__main__':
167
  main()