ombhojane commited on
Commit
12a81e0
Β·
1 Parent(s): 60feadf

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Load the image classification model
5
+ image_classification = pipeline("image-classification", model="ombhojane/healthyPlantsModel")
6
+
7
+ # Function to predict labels for the given image URL
8
+ def predict_labels(image_url):
9
+ result = image_classification(image_url)
10
+ return result[0]
11
+
12
+ # Create a Gradio interface
13
+ iface = gr.Interface(
14
+ fn=predict_labels,
15
+ inputs=gr.Image(type="url", label="Input Image URL"),
16
+ outputs=gr.Textbox(label="Predicted Label"),
17
+ live=True
18
+ )
19
+
20
+ # Launch the Gradio interface
21
+ iface.launch()