Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -402,8 +402,12 @@ async def predict(image):
|
|
402 |
<span class="dog-label" style="color: {color};">Dog {i+1}</span>
|
403 |
</div>
|
404 |
<div class="breed-info">
|
|
|
|
|
|
|
|
|
405 |
<h3 class="breeds-title">Top 3 possible breeds:</h3>
|
406 |
-
|
407 |
|
408 |
for j, (breed, prob) in enumerate(zip(topk_breeds, relative_probs)):
|
409 |
description = get_dog_description(breed)
|
@@ -533,11 +537,28 @@ def show_details_html(choice, previous_output, initial_state):
|
|
533 |
return f"<p style='color: red;'>{error_msg}</p>", gr.update(visible=True), initial_state
|
534 |
|
535 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
536 |
def format_description_html(description, breed):
|
537 |
html = "<ul style='list-style-type: none; padding-left: 0;'>"
|
538 |
if isinstance(description, dict):
|
539 |
for key, value in description.items():
|
540 |
-
|
|
|
|
|
541 |
elif isinstance(description, str):
|
542 |
html += f"<li>{description}</li>"
|
543 |
else:
|
|
|
402 |
<span class="dog-label" style="color: {color};">Dog {i+1}</span>
|
403 |
</div>
|
404 |
<div class="breed-info">
|
405 |
+
<div class="model-uncertainty-note">
|
406 |
+
Note: The model is showing some uncertainty in its predictions.
|
407 |
+
Here are the most likely breeds based on the available visual features.
|
408 |
+
</div>
|
409 |
<h3 class="breeds-title">Top 3 possible breeds:</h3>
|
410 |
+
'''
|
411 |
|
412 |
for j, (breed, prob) in enumerate(zip(topk_breeds, relative_probs)):
|
413 |
description = get_dog_description(breed)
|
|
|
537 |
return f"<p style='color: red;'>{error_msg}</p>", gr.update(visible=True), initial_state
|
538 |
|
539 |
|
540 |
+
# def format_description_html(description, breed):
|
541 |
+
# html = "<ul style='list-style-type: none; padding-left: 0;'>"
|
542 |
+
# if isinstance(description, dict):
|
543 |
+
# for key, value in description.items():
|
544 |
+
# html += f"<li style='margin-bottom: 10px;'><strong>{key}:</strong> {value}</li>"
|
545 |
+
# elif isinstance(description, str):
|
546 |
+
# html += f"<li>{description}</li>"
|
547 |
+
# else:
|
548 |
+
# html += f"<li>No description available for {breed}</li>"
|
549 |
+
# html += "</ul>"
|
550 |
+
# akc_link = get_akc_breeds_link(breed)
|
551 |
+
# html += f'<p><a href="{akc_link}" target="_blank">Learn more about {breed} on the AKC website</a></p>'
|
552 |
+
# return html
|
553 |
+
|
554 |
+
|
555 |
def format_description_html(description, breed):
|
556 |
html = "<ul style='list-style-type: none; padding-left: 0;'>"
|
557 |
if isinstance(description, dict):
|
558 |
for key, value in description.items():
|
559 |
+
# 跳過 Breed 資訊
|
560 |
+
if key != "Breed":
|
561 |
+
html += f"<li style='margin-bottom: 10px;'><strong>{key}:</strong> {value}</li>"
|
562 |
elif isinstance(description, str):
|
563 |
html += f"<li>{description}</li>"
|
564 |
else:
|