Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -421,7 +421,7 @@ async def predict(image):
|
|
421 |
.dog-info { border: 1px solid #ddd; margin-bottom: 20px; padding: 15px; border-radius: 5px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
|
422 |
.dog-info h2 { background-color: #f0f0f0; padding: 10px; margin: -15px -15px 15px -15px; border-radius: 5px 5px 0 0; }
|
423 |
.breed-buttons { margin-top: 10px; }
|
424 |
-
.breed-button { margin-right: 10px; padding: 5px 10px; background-color: #4CAF50; color: white; border: none; border-radius: 3px; cursor: pointer; }
|
425 |
</style>
|
426 |
"""
|
427 |
buttons = []
|
@@ -519,13 +519,16 @@ def show_details_html(choice, previous_output, initial_state):
|
|
519 |
print(error_msg)
|
520 |
return f"<p style='color: red;'>{error_msg}</p>", gr.update(visible=True), initial_state
|
521 |
|
|
|
522 |
def format_description_html(description, breed):
|
523 |
html = "<ul>"
|
524 |
if isinstance(description, dict):
|
525 |
for key, value in description.items():
|
526 |
html += f"<li><strong>{key}:</strong> {value}</li>"
|
527 |
-
|
528 |
html += f"<li>{description}</li>"
|
|
|
|
|
529 |
html += "</ul>"
|
530 |
akc_link = get_akc_breeds_link()
|
531 |
html += f'<p><a href="{akc_link}" target="_blank">Learn more about {breed} on the AKC website</a></p>'
|
|
|
421 |
.dog-info { border: 1px solid #ddd; margin-bottom: 20px; padding: 15px; border-radius: 5px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
|
422 |
.dog-info h2 { background-color: #f0f0f0; padding: 10px; margin: -15px -15px 15px -15px; border-radius: 5px 5px 0 0; }
|
423 |
.breed-buttons { margin-top: 10px; }
|
424 |
+
.breed-button { margin-right: 10px; margin-bottom: 10px; padding: 5px 10px; background-color: #4CAF50; color: white; border: none; border-radius: 3px; cursor: pointer; }
|
425 |
</style>
|
426 |
"""
|
427 |
buttons = []
|
|
|
519 |
print(error_msg)
|
520 |
return f"<p style='color: red;'>{error_msg}</p>", gr.update(visible=True), initial_state
|
521 |
|
522 |
+
|
523 |
def format_description_html(description, breed):
|
524 |
html = "<ul>"
|
525 |
if isinstance(description, dict):
|
526 |
for key, value in description.items():
|
527 |
html += f"<li><strong>{key}:</strong> {value}</li>"
|
528 |
+
elif isinstance(description, str):
|
529 |
html += f"<li>{description}</li>"
|
530 |
+
else:
|
531 |
+
html += f"<li>No description available for {breed}</li>"
|
532 |
html += "</ul>"
|
533 |
akc_link = get_akc_breeds_link()
|
534 |
html += f'<p><a href="{akc_link}" target="_blank">Learn more about {breed} on the AKC website</a></p>'
|