Spaces:
Sleeping
Sleeping
Brajananda Mahata
commited on
Commit
•
a72cdf0
1
Parent(s):
165b97d
first try
Browse files- app.py +16 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
|
5 |
+
model = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
|
6 |
+
|
7 |
+
def predict(image):
|
8 |
+
predictions = model(image)
|
9 |
+
return {p["label"]: p["score"] for p in predictions}
|
10 |
+
|
11 |
+
gr.Interface(
|
12 |
+
predict,
|
13 |
+
inputs=gr.image(label="Upload Image", type="filepath"),
|
14 |
+
outputs=gr.Label(num_top_classes=2),
|
15 |
+
title="Hotdog or not Hotdog? first try"
|
16 |
+
).launch()
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
torch
|