Spaces:
Sleeping
Sleeping
Init commit
Browse filesSigned-off-by: Aisuko <[email protected]>
- app.py +21 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
|
5 |
+
pipeline=pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
|
6 |
+
|
7 |
+
def predict(input_img):
|
8 |
+
predictions=pipeline(input_img)
|
9 |
+
return input_img, {p["label"]:p["score"] for p in predictions}
|
10 |
+
|
11 |
+
|
12 |
+
gradio_app=gr.Interface(
|
13 |
+
predict,
|
14 |
+
inputs=gr.Image(label="Select hot dog candidate", sources=['upload', 'webcam'], type="pil"),
|
15 |
+
outputs=[gr.Image(label="Processed Image"), gr.Label(label="Result", num_top_classes=2)],
|
16 |
+
title="Hot Dog or Not Hot Dog",
|
17 |
+
)
|
18 |
+
|
19 |
+
if __name__=="__main__":
|
20 |
+
gradio_app.launch()
|
21 |
+
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
torch==2.1.1
|
2 |
+
transformers==4.35.2
|