Kinley95 commited on
Commit
e65ec4c
1 Parent(s): cc646d3

Create app.py

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