imSleepy commited on
Commit
48792c7
·
verified ·
1 Parent(s): e9a9ef1

reverted it back to JSON response

Browse files
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -1,10 +1,14 @@
1
  import streamlit as st
2
- from chatbot import process_query
3
 
4
- st.title("Kivy Chatbot Backend")
 
5
 
6
- user_input = st.text_input("Ask a question:")
7
- if st.button("Get Response"):
8
- if user_input:
9
- response = process_query(user_input)
10
- st.write(f"Response: {response}")
 
 
 
 
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.")