DawnC commited on
Commit
5b172b8
1 Parent(s): 91ecec3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -14
app.py CHANGED
@@ -59,21 +59,18 @@ else:
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()
 
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()