Spaces:
Running
Running
Rohankumar31
commited on
Commit
•
40e5985
1
Parent(s):
549f596
Update stream.py
Browse files
stream.py
CHANGED
@@ -1,13 +1,27 @@
|
|
1 |
import streamlit as st
|
2 |
import main
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
#
|
11 |
-
st.
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
import main
|
3 |
+
def generate_response(user_query):
|
4 |
+
response = main.prints(user_query)
|
5 |
+
return response
|
6 |
+
st.title("Chatbot for Health Suggestions ;)")
|
7 |
+
st.write("Hello! I'm your chatbot. You can ask any query to me")
|
8 |
+
conversation_history = []
|
9 |
+
while True:
|
10 |
+
# User input
|
11 |
+
user_input = st.text_input("Enter your Query:",value="food for vata people",help="Ex: Food suggestions for Vata people")
|
12 |
+
|
13 |
+
if user_input:
|
14 |
+
# Add user input to conversation history
|
15 |
+
conversation_history.append(f"You: {user_input}")
|
16 |
+
|
17 |
+
# Generate and display the chatbot's response
|
18 |
+
chatbot_response = generate_response(user_input)
|
19 |
+
conversation_history.append(f"Chatbot: {chatbot_response}")
|
20 |
+
st.write("Chatbot:", chatbot_response)
|
21 |
+
|
22 |
+
# End the conversation if the user says goodbye
|
23 |
+
if "bye" in user_input.lower():
|
24 |
+
break
|
25 |
+
st.write("Full Conversation:")
|
26 |
+
for message in conversation_history:
|
27 |
+
st.write(message)
|