Asseh commited on
Commit
c589053
1 Parent(s): 538c137

Create app.py

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