import streamlit as st | |
from chatbot import process_query # Import your chatbot function | |
# Use st.query_params instead of st.experimental_get_query_params | |
user_input = st.query_params.get("user_input", [""])[0] | |
if user_input: | |
response = process_query(user_input) | |
# Display as JSON for HTTP GET request | |
st.json({"response": response}) | |
else: | |
# Default UI if no query is passed | |
st.title("Chatbot") | |
st.write("Enter a query in the URL as ?user_input=your_question to get a JSON response.") | |