File size: 615 Bytes
458eaee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import streamlit as st
import requests

# Title of the app
st.title("Backend API Test")
st.write("This app interacts with the backend to generate output.")

# Input from the user
input_data = st.text_input("Enter Input Data:", "")

if st.button("Generate"):
    # Make a POST request to your backend
    response = requests.post("http://127.0.0.1:8000/predict", json={"input_data": input_data})

    # Handle the response
    if response.status_code == 200:
        st.write("Result:", response.json().get("result", "No result found"))
    else:
        st.error(f"Error: {response.status_code} - {response.text}")