Demo / app.py
Shubhy's picture
Update app.py
1224937
raw
history blame contribute delete
No virus
747 Bytes
import streamlit as st
import requests
# Streamlit app title and description
st.title("AI Quote Explanation")
st.write("Enter a quote and get an explanation using AI.")
# User input for the quote
quote = st.text_input("Enter a quote")
# Check if the user has entered a quote
if quote:
# API endpoint for AI explanation
api_endpoint = "https://api.example.com/explain"
# Send a POST request to the API
response = requests.post(api_endpoint, json={"quote": quote})
# Check if the request was successful
if response.status_code == 200:
explanation = response.json()["explanation"]
st.write("Explanation:")
st.write(explanation)
else:
st.write("Error occurred. Please try again later.")