|
|
import streamlit as st |
|
|
from gradio_client import Client |
|
|
|
|
|
|
|
|
def predict_image_description(image_url): |
|
|
client = Client("https://ashrafb-imdes.hf.space/") |
|
|
result = client.predict(image_url, api_name="/predict") |
|
|
return result |
|
|
|
|
|
|
|
|
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...") |
|
|
|
|
|
|
|
|
description = predict_image_description(uploaded_file) |
|
|
st.write(f"Description: {description}") |
|
|
|
|
|
|