NDeee commited on
Commit
834b6ec
1 Parent(s): b075d82

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a pipeline as a high-level helper
2
+ from transformers import pipeline
3
+ import gradio as gr
4
+
5
+ pipe = pipeline("image-classification", model="julien-c/hotdog-not-hotdog")
6
+
7
+ def predict(img):
8
+ predictions = pipe(img)
9
+ return img,{p["label"]:p["score"] for p in predictions}
10
+
11
+ interface = gr.Interface(
12
+ fn = predict,
13
+ inputs = gr.Image(label = "Select hot dog image", sources = ['upload', 'webcam'], type = 'pil'),
14
+ outputs = [gr.Image(label = "Processed Image"), gr.Label(label="Result", num_top_classes=2)],
15
+ title = "Hot Dog or Not?"
16
+ )
17
+
18
+ interface.launch()