Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -59,21 +59,18 @@ else:
|
|
59 |
# 設定範例圖片
|
60 |
examples = [[examples_path + "/" + img] for img in os.listdir(examples_path)]
|
61 |
|
62 |
-
#
|
63 |
-
|
64 |
|
65 |
# Gradio 介面
|
66 |
-
demo = gr.
|
67 |
-
|
68 |
-
|
69 |
-
gr.
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
title='Oxford Pet 🐈🐕',
|
76 |
-
description='A ResNet50-based model for classifying 37 different pet breeds.',
|
77 |
-
article="[Oxford Project](https://github.com/Eric-Chung-0511/Learning-Record/tree/main/Data%20Science%20Projects/The%20Oxford-IIIT%20Pet%20Project)").launch()
|
78 |
|
79 |
demo.launch()
|
|
|
59 |
# 設定範例圖片
|
60 |
examples = [[examples_path + "/" + img] for img in os.listdir(examples_path)]
|
61 |
|
62 |
+
# 用戶可參考的品種列表
|
63 |
+
breed_list_text = "Recognizable Breeds:\n" + ", ".join(class_names)
|
64 |
|
65 |
# Gradio 介面
|
66 |
+
demo = gr.Interface(
|
67 |
+
fn=classify_image,
|
68 |
+
inputs=gr.Image(type="pil"), # 只需要圖片輸入
|
69 |
+
outputs=[gr.Label(num_top_classes=3, label="Top 3 Predictions")],
|
70 |
+
examples=examples,
|
71 |
+
title='Oxford Pet 🐈🐕',
|
72 |
+
description=f'A ResNet50-based model for classifying 37 different pet breeds.\n\n{breed_list_text}', # 直接把品種放到描述中
|
73 |
+
article='[Oxford Project](https://github.com/Eric-Chung-0511/Learning-Record/tree/main/Data%20Science%20Projects/The%20Oxford-IIIT%20Pet%20Project)'
|
74 |
+
)
|
|
|
|
|
|
|
75 |
|
76 |
demo.launch()
|