Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
| 7 |
-
|
| 8 |
|
| 9 |
gradio_app = gr.Interface(
|
| 10 |
predict,
|
| 11 |
-
inputs
|
| 12 |
-
outputs
|
| 13 |
-
title
|
| 14 |
)
|
| 15 |
|
| 16 |
-
if
|
| 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()
|