added the httpx in app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,14 @@
|
|
1 |
import streamlit as st
|
2 |
-
|
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 |
-
|
10 |
-
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
import httpx
|
3 |
|
4 |
st.title("Kivy Chatbot Backend")
|
5 |
|
6 |
user_input = st.text_input("Ask a question:")
|
7 |
+
|
8 |
if st.button("Get Response"):
|
9 |
if user_input:
|
10 |
+
# Make a POST request to the FastAPI /predict endpoint
|
11 |
+
url = "http://localhost:8000/predict" # Assuming FastAPI is running locally or use the correct URL
|
12 |
+
response = httpx.post(url, json={"input": user_input})
|
13 |
+
bot_response = response.json().get("response", "No response found")
|
14 |
+
st.write(f"Response: {bot_response}")
|