Spaces:
Sleeping
Sleeping
Delete app.py
Browse files
app.py
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
from transformers import pipeline
|
3 |
-
|
4 |
-
# 建立模型
|
5 |
-
classifier = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
|
6 |
-
|
7 |
-
# 預測函式
|
8 |
-
def predict(image):
|
9 |
-
predictions = classifier(image)
|
10 |
-
return {p["label"]: p["score"] for p in predictions}
|
11 |
-
|
12 |
-
# 建立介面
|
13 |
-
gr.Interface(
|
14 |
-
fn=predict,
|
15 |
-
inputs=gr.Image(label="Upload hot dog candidate", type="filepath"),
|
16 |
-
outputs=gr.Label(num_top_classes=2),
|
17 |
-
title="🌭 Hot Dog? Or Not?",
|
18 |
-
allow_flagging="manual"
|
19 |
-
).launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|