marcsaouda commited on
Commit
fe06352
·
verified ·
1 Parent(s): fc5c218

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -8
app.py CHANGED
@@ -3,28 +3,34 @@ import gradio as gr
3
  from transformers import pipeline
4
 
5
 
 
 
6
  model = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
7
 
8
 
9
 
10
 
11
- def predict (image):
12
 
13
- predictions = model(image)
14
 
15
- return {p["label"]: p["score"] for p in predictions}
 
 
 
 
 
 
16
 
17
 
18
 
19
 
20
  gr.Interface(
21
 
22
- predict,
23
 
24
- inputs=gr.Image(label="Upload image", type="filepath"),
25
 
26
- outputs=gr.Label(num_top_classes=2),
27
 
28
- title="Hotdog or Not Hotdog?"
29
 
30
- ).launch()
 
3
  from transformers import pipeline
4
 
5
 
6
+
7
+
8
  model = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
9
 
10
 
11
 
12
 
 
13
 
 
14
 
15
+ def predict(image):
16
+
17
+ predictions = model(image)
18
+
19
+ return {p["label"]: p["score"] for p in predictions}
20
+
21
+
22
 
23
 
24
 
25
 
26
  gr.Interface(
27
 
28
+ predict,
29
 
30
+ inputs=gr.Image(label="Upload image", type="filepath"),
31
 
32
+ outputs=gr.Label(num_top_classes=2),
33
 
34
+ title="Hotdog or Not Hotdog?",
35
 
36
+ ).launch()