BenTouss commited on
Commit
97f0e64
1 Parent(s): cb0af97
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -3,15 +3,18 @@ from transformers import pipeline
3
 
4
  pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
5
 
6
- def predict(image):
7
  print('hello!')
8
- print(image)
9
- predictions = pipeline(image)
10
  return {p["label"]: p["score"] for p in predictions}
11
 
12
- gr.Interface(
13
  predict,
14
  inputs=gr.Image(label="Select hot dog candidate", type="pil"),
15
  outputs=gr.Label(num_top_classes=2),
16
  title="Hot Dog? Or Not?",
17
- ).launch()
 
 
 
 
3
 
4
  pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
5
 
6
+ def predict(input_img):
7
  print('hello!')
8
+ print(input_img)
9
+ predictions = pipeline(input_img)
10
  return {p["label"]: p["score"] for p in predictions}
11
 
12
+ gradio_app = gr.Interface(
13
  predict,
14
  inputs=gr.Image(label="Select hot dog candidate", type="pil"),
15
  outputs=gr.Label(num_top_classes=2),
16
  title="Hot Dog? Or Not?",
17
+ )
18
+
19
+ if __name__ == "__main__":
20
+ gradio_app.launch()