Tshering12 commited on
Commit
12e0c5e
·
verified ·
1 Parent(s): e2e2a7a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -3,15 +3,15 @@ from transformers import pipeline
3
  pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
4
 
5
  def predict(input_img):
6
- predictions = pipeline(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()
 
3
  pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
4
 
5
  def predict(input_img):
6
+ predictions = pipeline(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 __name__ == "__main__": # Fixed here
17
+ gradio_app.launch()