DawnC commited on
Commit
d5acdd3
·
1 Parent(s): 7846680

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -319,20 +319,22 @@ async def predict(image):
319
  dogs_info += "</ul>"
320
 
321
  # 生成與品種對應的按鈕
322
- buttons_html = "" # 確保每次生成按鈕前清空
323
  for breed in topk_breeds[:3]:
324
  button_id = f"Dog {i+1}: More about {breed}"
325
- buttons_html += f'<button class="breed-button" onclick="handle_button_click(\'{button_id}\')">{breed}</button>'
326
  buttons.append(button_id)
 
327
 
328
  # 確保按鈕插入在品種列表內部,而不是最後添加
329
- dogs_info += f'<div class="breed-buttons">{buttons_html}</div>'
330
 
331
  else:
332
  dogs_info += "<p>The image is unclear or the breed is not in the dataset. Please upload a clearer image.</p>"
333
 
334
  dogs_info += '</div>' # 結束當前狗的資訊區塊
335
 
 
336
 
337
 
338
  buttons_html = ""
 
319
  dogs_info += "</ul>"
320
 
321
  # 生成與品種對應的按鈕
322
+ buttons_html = "<div style='margin-top: 10px;'>" # 加入 div 標籤並加入間距
323
  for breed in topk_breeds[:3]:
324
  button_id = f"Dog {i+1}: More about {breed}"
325
+ buttons_html += f'<button class="breed-button" onclick="handle_button_click(\'{button_id}\')">{breed}</button> '
326
  buttons.append(button_id)
327
+ buttons_html += "</div>" # 結束 div 標籤
328
 
329
  # 確保按鈕插入在品種列表內部,而不是最後添加
330
+ dogs_info += f'{buttons_html}' # 直接插入按鈕
331
 
332
  else:
333
  dogs_info += "<p>The image is unclear or the breed is not in the dataset. Please upload a clearer image.</p>"
334
 
335
  dogs_info += '</div>' # 結束當前狗的資訊區塊
336
 
337
+
338
 
339
 
340
  buttons_html = ""