Spaces:
Sleeping
Sleeping
test
Browse files
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(
|
| 7 |
print('hello!')
|
| 8 |
-
print(
|
| 9 |
-
predictions = pipeline(
|
| 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 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
| 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()
|