DawnC commited on
Commit
91ecec3
·
verified ·
1 Parent(s): 9ac86e7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -11
app.py CHANGED
@@ -59,18 +59,21 @@ else:
59
  # 設定範例圖片
60
  examples = [[examples_path + "/" + img] for img in os.listdir(examples_path)]
61
 
62
- # 新增下拉選單,顯示所有品種
63
- dropdown = gr.Dropdown(choices=class_names, label="Select a breed", type="value")
64
 
65
  # Gradio 介面
66
- demo = gr.Interface(
67
- fn=classify_image,
68
- inputs=[gr.Image(type="pil")], # 移除掉 dropdown 作為輸入
69
- outputs=[gr.Label(num_top_classes=3, label="Top 3 Predictions")],
70
- examples=examples,
71
- title='Oxford Pet 🐈🐕',
72
- description='A ResNet50-based model for classifying 37 different pet breeds.',
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()
 
59
  # 設定範例圖片
60
  examples = [[examples_path + "/" + img] for img in os.listdir(examples_path)]
61
 
62
+ # 建立 Markdown 清單顯示所有品種
63
+ breed_list = "### Recognizable Breeds\n" + "\n".join([f"- {breed}" for breed in class_names])
64
 
65
  # Gradio 介面
66
+ demo = gr.Blocks()
67
+
68
+ with demo:
69
+ gr.Markdown("# Oxford Pet 🐕🐈 Recognizable Breeds")
70
+ gr.Markdown(breed_list) # 用 Markdown 顯示品種列表
71
+ gr.Interface(fn=classify_image,
72
+ inputs=gr.Image(type="pil"), # 只需要圖片輸入
73
+ outputs=[gr.Label(num_top_classes=3, label="Top 3 Predictions")],
74
+ examples=examples,
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()