-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
29 lines (23 loc) · 850 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import streamlit as st
from run import query_bot
# Function to get response from your chatbot
def get_chatbot_response(user_input):
response = query_bot(user_input)
return response
# Initialize session state for conversation history
if 'history' not in st.session_state:
st.session_state.history = []
st.title("RAG Chatbot")
st.write("Ask anything!")
user_input = st.text_input("You: ", "")
if st.button("Send"):
if user_input:
with st.spinner('Processing...'):
response = get_chatbot_response(user_input)
st.session_state.history.append((user_input, response))
user_input = "" # Clear input after sending
# Display conversation history
for user_query, bot_response in st.session_state.history:
st.write(f"You: {user_query}")
st.write(f"Chatbot: {bot_response}")
st.write("---")