Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -528,7 +528,6 @@ async def predict(image):
|
|
528 |
draw.text((box[0] + 5, box[1] + 5), f"Dog {i+1}", fill=color, font=font)
|
529 |
|
530 |
combined_confidence = detection_confidence * top1_prob
|
531 |
-
#dogs_info += f'<div class="dog-info" style="border-left: 5px solid {color};">'
|
532 |
dogs_info += f'<div class="dog-info" style="border-left: 5px solid {color}; margin-bottom: 20px; padding: 15px;">'
|
533 |
dogs_info += f'<h2>Dog {i+1}</h2>'
|
534 |
|
@@ -542,15 +541,13 @@ 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 |
-
|
553 |
-
|
554 |
else:
|
555 |
dogs_info += "<p>The image is unclear or the breed is not in the dataset. Please upload a clearer image.</p>"
|
556 |
|
|
|
528 |
draw.text((box[0] + 5, box[1] + 5), f"Dog {i+1}", fill=color, font=font)
|
529 |
|
530 |
combined_confidence = detection_confidence * top1_prob
|
|
|
531 |
dogs_info += f'<div class="dog-info" style="border-left: 5px solid {color}; margin-bottom: 20px; padding: 15px;">'
|
532 |
dogs_info += f'<h2>Dog {i+1}</h2>'
|
533 |
|
|
|
541 |
for j, (breed, prob) in enumerate(zip(topk_breeds[:3], topk_probs_percent[:3])):
|
542 |
dogs_info += f"<li><strong>{breed}</strong> ({prob} confidence)</li>"
|
543 |
dogs_info += "</ul>"
|
544 |
+
#buttons_html += '<div class="breed-buttons">'
|
545 |
+
buttons_html = '<div class="breed-buttons">' #new
|
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 |
else:
|
552 |
dogs_info += "<p>The image is unclear or the breed is not in the dataset. Please upload a clearer image.</p>"
|
553 |
|