Rohankumar31 commited on
Commit
40e5985
1 Parent(s): 549f596

Update stream.py

Browse files
Files changed (1) hide show
  1. stream.py +25 -11
stream.py CHANGED
@@ -1,13 +1,27 @@
1
  import streamlit as st
2
  import main
3
- st.title("Health Suggestions")
4
- query = st.text_input("Enter your Query:",value="food for vata people",help="Ex: Food suggestions for Vata people")
5
- received_data = None
6
- def receive_data(data):
7
- global received_data
8
- received_data = main.prints(data)
9
- if st.button("Process"):
10
- # Call the Python file to process the query
11
- st.write("Processed Result:")
12
- receive_data(query)
13
- st.write(received_data)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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)