File size: 695 Bytes
df8bb52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import streamlit as st
import requests

# Run this with: streamlit run streamlit_app.py
# Streamlit interface
st.title("Gemini Central Console Bot")
user_input = st.text_input("Enter your text here")
url = "http://localhost:8000/predict"  # URL of your FastAPI predict endpoint

if st.button("Submit"):
    # Prepare the payload
    payload = {"prompt": user_input}

    # Send the request to FastAPI endpoint
    response = requests.post(url, json=payload)

    # Display the response
    if response.status_code == 200:
        result = response.json()
        content = result["choices"][0]["message"]["content"]
        st.write(content)
    else:
        st.write("Failed to get response")