Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -542,19 +542,23 @@ async def predict(image):
|
|
542 |
for j, (breed, prob) in enumerate(zip(topk_breeds[:3], topk_probs_percent[:3])):
|
543 |
dogs_info += f"<li><strong>{breed}</strong> ({prob} confidence)</li>"
|
544 |
dogs_info += "</ul>"
|
545 |
-
buttons_html += '<div class="breed-buttons">'
|
|
|
546 |
for breed in topk_breeds[:3]:
|
547 |
button_id = f"Dog {i+1}: More about {breed}"
|
548 |
buttons_html += f'<button class="breed-button" onclick="handle_button_click(\'{button_id}\')">{breed}</button>'
|
549 |
buttons.append(button_id)
|
550 |
-
buttons_html += '</div>'
|
|
|
|
|
551 |
|
552 |
else:
|
553 |
dogs_info += "<p>The image is unclear or the breed is not in the dataset. Please upload a clearer image.</p>"
|
554 |
|
555 |
dogs_info += '</div>'
|
556 |
|
557 |
-
dogs_info += buttons_html
|
|
|
558 |
|
559 |
# html_output = f"""
|
560 |
# <style>
|
|
|
542 |
for j, (breed, prob) in enumerate(zip(topk_breeds[:3], topk_probs_percent[:3])):
|
543 |
dogs_info += f"<li><strong>{breed}</strong> ({prob} confidence)</li>"
|
544 |
dogs_info += "</ul>"
|
545 |
+
#buttons_html += '<div class="breed-buttons">' 原本有
|
546 |
+
dogs_info += '<div class="breed-buttons">' # new
|
547 |
for breed in topk_breeds[:3]:
|
548 |
button_id = f"Dog {i+1}: More about {breed}"
|
549 |
buttons_html += f'<button class="breed-button" onclick="handle_button_click(\'{button_id}\')">{breed}</button>'
|
550 |
buttons.append(button_id)
|
551 |
+
#buttons_html += '</div>' 原本有
|
552 |
+
dogs_info += '</div>' # new
|
553 |
+
|
554 |
|
555 |
else:
|
556 |
dogs_info += "<p>The image is unclear or the breed is not in the dataset. Please upload a clearer image.</p>"
|
557 |
|
558 |
dogs_info += '</div>'
|
559 |
|
560 |
+
#dogs_info += buttons_html 原本有
|
561 |
+
|
562 |
|
563 |
# html_output = f"""
|
564 |
# <style>
|