Spaces:
Sleeping
Sleeping
Add Streamlit app
Browse files
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import requests
|
| 3 |
+
|
| 4 |
+
# Title of the app
|
| 5 |
+
st.title("Backend API Test")
|
| 6 |
+
st.write("This app interacts with the backend to generate output.")
|
| 7 |
+
|
| 8 |
+
# Input from the user
|
| 9 |
+
input_data = st.text_input("Enter Input Data:", "")
|
| 10 |
+
|
| 11 |
+
if st.button("Generate"):
|
| 12 |
+
# Make a POST request to your backend
|
| 13 |
+
response = requests.post("http://127.0.0.1:8000/predict", json={"input_data": input_data})
|
| 14 |
+
|
| 15 |
+
# Handle the response
|
| 16 |
+
if response.status_code == 200:
|
| 17 |
+
st.write("Result:", response.json().get("result", "No result found"))
|
| 18 |
+
else:
|
| 19 |
+
st.error(f"Error: {response.status_code} - {response.text}")
|