Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -385,20 +385,25 @@ async def predict(image):
|
|
385 |
breed = topk_breeds[0]
|
386 |
description = get_dog_description(breed)
|
387 |
dogs_info += format_description_html(description, breed)
|
|
|
|
|
|
|
|
|
|
|
|
|
388 |
elif combined_confidence >= 0.15:
|
389 |
dogs_info += f"<p>Top 3 possible breeds:</p><ul>"
|
390 |
for j, (breed, prob) in enumerate(zip(topk_breeds[:3], topk_probs_percent[:3])):
|
391 |
prob = float(prob.replace('%', ''))
|
392 |
dogs_info += f"<li><strong>{breed}</strong> ({prob:.2f}% confidence)</li>"
|
393 |
|
394 |
-
#
|
395 |
button_id = f"Dog {i+1}: More about {breed}"
|
396 |
buttons_html += f'<button style="display:inline-block; margin-right:10px;" onclick="handle_button_click(\'{button_id}\')">{breed}</button>'
|
397 |
|
398 |
dogs_info += "</ul>"
|
399 |
-
|
400 |
-
|
401 |
-
dogs_info += buttons_html
|
402 |
|
403 |
else:
|
404 |
dogs_info += "<p>The image is unclear or the breed is not in the dataset. Please upload a clearer image.</p>"
|
@@ -417,6 +422,7 @@ async def predict(image):
|
|
417 |
"""
|
418 |
|
419 |
|
|
|
420 |
return html_output, annotated_image, gr.update(visible=True, choices=buttons), initial_state
|
421 |
|
422 |
except Exception as e:
|
|
|
385 |
breed = topk_breeds[0]
|
386 |
description = get_dog_description(breed)
|
387 |
dogs_info += format_description_html(description, breed)
|
388 |
+
|
389 |
+
# ๅจ 0.45 ไปฅไธๆ
ๆณไธ็ดๆฅๆๅ
ฅๆ้
|
390 |
+
button_id = f"Dog {i+1}: More about {breed}"
|
391 |
+
buttons_html += f'<button style="display:inline-block; margin-right:10px;" onclick="handle_button_click(\'{button_id}\')">{breed}</button>'
|
392 |
+
dogs_info += f'<div class="breed-buttons">{buttons_html}</div>'
|
393 |
+
|
394 |
elif combined_confidence >= 0.15:
|
395 |
dogs_info += f"<p>Top 3 possible breeds:</p><ul>"
|
396 |
for j, (breed, prob) in enumerate(zip(topk_breeds[:3], topk_probs_percent[:3])):
|
397 |
prob = float(prob.replace('%', ''))
|
398 |
dogs_info += f"<li><strong>{breed}</strong> ({prob:.2f}% confidence)</li>"
|
399 |
|
400 |
+
# ็บๆฏๅๅ็จฎๆๅ
ฅๆ้
|
401 |
button_id = f"Dog {i+1}: More about {breed}"
|
402 |
buttons_html += f'<button style="display:inline-block; margin-right:10px;" onclick="handle_button_click(\'{button_id}\')">{breed}</button>'
|
403 |
|
404 |
dogs_info += "</ul>"
|
405 |
+
# ๆๅ
ฅๆ้
|
406 |
+
dogs_info += f'<div class="breed-buttons">{buttons_html}</div>'
|
|
|
407 |
|
408 |
else:
|
409 |
dogs_info += "<p>The image is unclear or the breed is not in the dataset. Please upload a clearer image.</p>"
|
|
|
422 |
"""
|
423 |
|
424 |
|
425 |
+
|
426 |
return html_output, annotated_image, gr.update(visible=True, choices=buttons), initial_state
|
427 |
|
428 |
except Exception as e:
|