File size: 584 Bytes
91ef342
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# app.py
import streamlit as st
import requests

st.title("Gemini API Tester")

input_text = st.text_area("Type something...")

if st.button("Send"):
    try:
        response = requests.post(
            "http://fastapi:8000/generate", 
            json={"text": input_text}
        )
        response_data = response.json()

        if response.status_code == 200:
            st.success(response_data["generated_text"])
        else:
            st.error(f"Error: {response_data.get('detail', 'Unknown error')}")
    except Exception as e:
        st.error(f"Request failed: {e}")