Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
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'
|
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 = ""
|