Spaces:
Runtime error
Runtime error
Chong-U Lim
commited on
Commit
·
2456a23
1
Parent(s):
ffe4330
Predictor
Browse files
app.py
CHANGED
@@ -1,9 +1,25 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
|
|
3 |
|
4 |
-
def greet(name):
|
5 |
-
return f"Hello {name}!!"
|
6 |
|
|
|
|
|
|
|
7 |
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
|
4 |
+
pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
|
5 |
|
|
|
|
|
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 |
+
app = gr.Interface(
|
13 |
+
predict,
|
14 |
+
inputs=gr.Image(
|
15 |
+
label="Select hot dog candidate", sources=["upload", "webcam"], type="pil"
|
16 |
+
),
|
17 |
+
outputs=[
|
18 |
+
gr.Image(label="Processed Image"),
|
19 |
+
gr.Label(label="Result", num_top_classes=2),
|
20 |
+
],
|
21 |
+
title="Hot Dog? Or Not?",
|
22 |
+
)
|
23 |
+
|
24 |
+
if __name__ == "__main__":
|
25 |
+
app.launch()
|