DawnC commited on
Commit
b76b4a2
·
1 Parent(s): 0092d74

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -389,23 +389,23 @@ async def predict(image):
389
  dogs_info += f"<li><strong>{breed}</strong> ({prob:.2f}% confidence)</li>"
390
  dogs_info += "</ul>"
391
 
 
392
  for breed in topk_breeds[:3]:
393
  button_id = f"Dog {i+1}: More about {breed}"
394
  buttons_html += f'<button class="breed-button" onclick="handle_button_click(\'{button_id}\')">{breed}</button>'
395
  buttons.append(button_id)
396
-
397
-
 
 
398
 
399
  else:
400
  dogs_info += "<p>The image is unclear or the breed is not in the dataset. Please upload a clearer image.</p>"
 
 
401
 
402
-
403
- # 在該品種區塊中顯示按鈕
404
- dogs_info += f'<div class="breed-buttons">{buttons_html}</div>'
405
- dogs_info += '</div>'
406
 
407
- # 清空 buttons_html 確保不會在整體上出現重複
408
- buttons_html = ""
409
 
410
  html_output = f"""
411
  <style>
 
389
  dogs_info += f"<li><strong>{breed}</strong> ({prob:.2f}% confidence)</li>"
390
  dogs_info += "</ul>"
391
 
392
+ buttons_html += '<div class="breed-buttons">' # 新的按鈕區塊
393
  for breed in topk_breeds[:3]:
394
  button_id = f"Dog {i+1}: More about {breed}"
395
  buttons_html += f'<button class="breed-button" onclick="handle_button_click(\'{button_id}\')">{breed}</button>'
396
  buttons.append(button_id)
397
+ buttons_html += '</div>' # 結束按鈕區塊
398
+
399
+ # 將按鈕直接插入每個區塊內
400
+ dogs_info += buttons_html
401
 
402
  else:
403
  dogs_info += "<p>The image is unclear or the breed is not in the dataset. Please upload a clearer image.</p>"
404
+
405
+ dogs_info += '</div>' # 結束狗區塊
406
 
 
 
 
 
407
 
408
+
 
409
 
410
  html_output = f"""
411
  <style>