DawnC commited on
Commit
5fbe3b3
·
1 Parent(s): 89551cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -331,13 +331,13 @@ async def predict(image):
331
  prob = float(prob.replace('%', ''))
332
  dogs_info += f"<li><strong>{breed}</strong> ({prob:.2f}% confidence)</li>"
333
 
334
- # 為每個品種插入按鈕
335
  button_id = f"Dog {i+1}: More about {breed}"
336
  buttons_html += f'<button style="display:inline-block; margin-top:10px;" onclick="handle_button_click(\'{button_id}\')">{breed}</button>'
 
337
 
338
  dogs_info += "</ul>"
339
- # 確保只在這個條件下顯示按鈕
340
- dogs_info += f'<div>{buttons_html}</div>'
341
 
342
  else:
343
  dogs_info += "<p>The image is unclear or the breed is not in the dataset. Please upload a clearer image.</p>"
 
331
  prob = float(prob.replace('%', ''))
332
  dogs_info += f"<li><strong>{breed}</strong> ({prob:.2f}% confidence)</li>"
333
 
334
+ # 為每個品種生成按鈕並輸出確認訊息
335
  button_id = f"Dog {i+1}: More about {breed}"
336
  buttons_html += f'<button style="display:inline-block; margin-top:10px;" onclick="handle_button_click(\'{button_id}\')">{breed}</button>'
337
+ print(f"Button generated for breed: {breed}") # 檢查按鈕是否生成
338
 
339
  dogs_info += "</ul>"
340
+ dogs_info += f'<div>{buttons_html}</div>' # 確保按鈕顯示在該品種描述下
 
341
 
342
  else:
343
  dogs_info += "<p>The image is unclear or the breed is not in the dataset. Please upload a clearer image.</p>"