Spaces:
Runtime error
Runtime error
Commit
β’
d8f620d
1
Parent(s):
47aaca2
app.py
Browse files
README.md
CHANGED
@@ -1,12 +1,25 @@
|
|
1 |
---
|
2 |
title: Sandwich Classifier
|
3 |
emoji: π
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
sdk_version: 4.31.1
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
---
|
|
|
|
|
11 |
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
title: Sandwich Classifier
|
3 |
emoji: π
|
4 |
+
colorFrom: indigo
|
5 |
+
colorTo: purple
|
6 |
sdk: gradio
|
7 |
sdk_version: 4.31.1
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
---
|
11 |
+
import gradio as gr
|
12 |
+
from transformers import pipeline
|
13 |
|
14 |
+
pipeline = pipeline(task="image-classification", model="akansha2k2/Burger_sandwich_pizza")
|
15 |
+
|
16 |
+
def predict(image):
|
17 |
+
predictions = pipeline(image)
|
18 |
+
return {p["label"]: p["score"] for p in predictions}
|
19 |
+
|
20 |
+
gr.Interface(
|
21 |
+
predict,
|
22 |
+
inputs=gr.Image(label="Upload junk food (sandwich,pizza,burgur) candidate", type="filepath"),
|
23 |
+
outputs=gr.Label(num_top_classes=2),
|
24 |
+
title="pizza or burgur or sandwich?",
|
25 |
+
).launch()
|