TenzinNYeshey commited on
Commit
8a62433
1 Parent(s): 7f66cd4

Create app.py

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