Jeet Paul
commited on
Commit
·
2cbf1ad
1
Parent(s):
48c3d1b
Update app.py
Browse files
app.py
CHANGED
@@ -152,7 +152,7 @@ def get_response(user_input):
|
|
152 |
|
153 |
return "Thank you for sharing. How can I assist you today?"
|
154 |
|
155 |
-
def main():
|
156 |
st.title("Mental Health Chatbot")
|
157 |
st.write("Enter your message and get a response from the chatbot:")
|
158 |
|
@@ -163,6 +163,27 @@ def main():
|
|
163 |
st.write("Bot Response:")
|
164 |
st.write(response)
|
165 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
if __name__ == '__main__':
|
167 |
main()
|
|
|
168 |
|
|
|
152 |
|
153 |
return "Thank you for sharing. How can I assist you today?"
|
154 |
|
155 |
+
'''def main():
|
156 |
st.title("Mental Health Chatbot")
|
157 |
st.write("Enter your message and get a response from the chatbot:")
|
158 |
|
|
|
163 |
st.write("Bot Response:")
|
164 |
st.write(response)
|
165 |
|
166 |
+
if __name__ == '__main__':
|
167 |
+
main()'''
|
168 |
+
def main():
|
169 |
+
st.title("Mental Health Chatbot")
|
170 |
+
st.write("Enter your message and get a response from the chatbot:")
|
171 |
+
|
172 |
+
# Create a text_area for displaying conversation history with a scrollbar
|
173 |
+
conversation_history = st.text_area("Conversation History:", "", height=200, max_chars=500, key="conversation")
|
174 |
+
|
175 |
+
user_input = st.text_input("User Input:")
|
176 |
+
|
177 |
+
if st.button("Submit"):
|
178 |
+
response = get_response(user_input)
|
179 |
+
|
180 |
+
# Append the new conversation to the conversation_history
|
181 |
+
conversation_history += f"You: {user_input}\nBot: {response}\n\n"
|
182 |
+
|
183 |
+
# Display the updated conversation
|
184 |
+
st.text_area("Conversation History:", conversation_history, height=200, max_chars=500, key="conversation")
|
185 |
+
|
186 |
if __name__ == '__main__':
|
187 |
main()
|
188 |
+
|
189 |
|