HGZeon commited on
Commit
063cba2
·
1 Parent(s): 3374409

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
5
+
6
+
7
+ def predict(image):
8
+ predictions = pipeline(image)
9
+ return {p["label"]: p["score"] for p in predictions}
10
+
11
+
12
+ gr.Interface(
13
+ predict,
14
+ inputs=gr.inputs.Image(label="Upload hot dog candidate", type="filepath"),
15
+ outputs=gr.outputs.Label(num_top_classes=2),
16
+ title="Hot Dog? Or Not?",
17
+ ).launch()