Tshering12 commited on
Commit
8eb5176
·
verified ·
1 Parent(s): 186e330

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py CHANGED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+ pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
4
+
5
+ def predict(input_img):
6
+ predictions = pipe(input_img)
7
+ return input_img, {p["label"]: p["score"] for p in predictions}
8
+
9
+ gradio_app = gr.Interface(
10
+ predict,
11
+ inputs = gr.Image(label="Select hot dog candidate", 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
+
16
+ if __main__="__main__":
17
+ gradio_app.launch()