Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -342,12 +342,19 @@ Dog {i}: Detected with moderate confidence. Here are the top 3 possible breeds:
|
|
342 |
buttons.append(f"More about Dog {i}: {breed}")
|
343 |
|
344 |
final_explanation = "\n\n---\n\n".join(explanations)
|
345 |
-
|
|
|
|
|
|
|
|
|
346 |
|
347 |
except Exception as e:
|
348 |
return f"An error occurred: {e}", None, gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
|
349 |
|
350 |
def show_details(choice):
|
|
|
|
|
|
|
351 |
try:
|
352 |
_, breed = choice.split(": ", 1)
|
353 |
description = get_dog_description(breed)
|
|
|
342 |
buttons.append(f"More about Dog {i}: {breed}")
|
343 |
|
344 |
final_explanation = "\n\n---\n\n".join(explanations)
|
345 |
+
|
346 |
+
if buttons:
|
347 |
+
return final_explanation, annotated_image, gr.update(visible=True, choices=buttons), gr.update(visible=False), gr.update(visible=False)
|
348 |
+
else:
|
349 |
+
return final_explanation, annotated_image, gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
|
350 |
|
351 |
except Exception as e:
|
352 |
return f"An error occurred: {e}", None, gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
|
353 |
|
354 |
def show_details(choice):
|
355 |
+
if not choice:
|
356 |
+
return "Please select a breed to view details."
|
357 |
+
|
358 |
try:
|
359 |
_, breed = choice.split(": ", 1)
|
360 |
description = get_dog_description(breed)
|