Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -122,15 +122,24 @@ qa = RetrievalQA.from_chain_type(
|
|
| 122 |
chain_type_kwargs={"prompt": prompt},
|
| 123 |
)
|
| 124 |
|
| 125 |
-
import
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
chain_type_kwargs={"prompt": prompt},
|
| 123 |
)
|
| 124 |
|
| 125 |
+
import streamlit as st
|
| 126 |
+
|
| 127 |
+
# Streamlit interface
|
| 128 |
+
st.title("Chatbot Interface")
|
| 129 |
+
|
| 130 |
+
# Define function to handle user input and display chatbot response
|
| 131 |
+
def chatbot_response(user_input):
|
| 132 |
+
response = qa.get_answer(user_input)
|
| 133 |
+
return response
|
| 134 |
+
|
| 135 |
+
# Streamlit components
|
| 136 |
+
user_input = st.text_input("You:", "")
|
| 137 |
+
submit_button = st.button("Send")
|
| 138 |
+
|
| 139 |
+
# Handle user input
|
| 140 |
+
if submit_button:
|
| 141 |
+
if user_input.strip() != "":
|
| 142 |
+
bot_response = chatbot_response(user_input)
|
| 143 |
+
st.text_area("Bot:", value=bot_response, height=200)
|
| 144 |
+
else:
|
| 145 |
+
st.warning("Please enter a message.")
|