Imca / app.py
Ashrafb's picture
Create app.py
d86c892
raw
history blame
743 Bytes
import streamlit as st
from gradio_client import Client
# Function to make API prediction
def predict_image_description(image_url):
client = Client("https://ashrafb-imdes.hf.space/")
result = client.predict(image_url, api_name="/predict")
return result
# Streamlit UI
st.title("Image Description App")
st.write("Upload an image and click the button to get a description!")
uploaded_file = st.file_uploader("Choose an image...", type="jpg")
if uploaded_file is not None:
st.image(uploaded_file, caption="Uploaded Image.", use_column_width=True)
st.write("")
st.write("Classifying...")
# Make API prediction
description = predict_image_description(uploaded_file)
st.write(f"Description: {description}")