reverted it back to JSON response
Browse files
app.py
CHANGED
|
@@ -1,10 +1,14 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
from chatbot import process_query
|
| 3 |
|
| 4 |
-
st.
|
|
|
|
| 5 |
|
| 6 |
-
user_input
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
from chatbot import process_query # Import your chatbot function
|
| 3 |
|
| 4 |
+
# Use st.query_params instead of st.experimental_get_query_params
|
| 5 |
+
user_input = st.query_params.get("user_input", [""])[0]
|
| 6 |
|
| 7 |
+
if user_input:
|
| 8 |
+
response = process_query(user_input)
|
| 9 |
+
# Display as JSON for HTTP GET request
|
| 10 |
+
st.json({"response": response})
|
| 11 |
+
else:
|
| 12 |
+
# Default UI if no query is passed
|
| 13 |
+
st.title("Chatbot")
|
| 14 |
+
st.write("Enter a query in the URL as ?user_input=your_question to get a JSON response.")
|