Ashrafb commited on
Commit
d86c892
·
1 Parent(s): ac09d89

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from gradio_client import Client
3
+
4
+ # Function to make API prediction
5
+ def predict_image_description(image_url):
6
+ client = Client("https://ashrafb-imdes.hf.space/")
7
+ result = client.predict(image_url, api_name="/predict")
8
+ return result
9
+
10
+ # Streamlit UI
11
+ st.title("Image Description App")
12
+ st.write("Upload an image and click the button to get a description!")
13
+
14
+ uploaded_file = st.file_uploader("Choose an image...", type="jpg")
15
+
16
+ if uploaded_file is not None:
17
+ st.image(uploaded_file, caption="Uploaded Image.", use_column_width=True)
18
+ st.write("")
19
+ st.write("Classifying...")
20
+
21
+ # Make API prediction
22
+ description = predict_image_description(uploaded_file)
23
+ st.write(f"Description: {description}")
24
+