Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -411,17 +411,18 @@ with gr.Blocks(css="""
|
|
411 |
breed_buttons = gr.Radio([], label="Select breed for more details", visible=False)
|
412 |
breed_details = gr.Markdown(label="Breed Details")
|
413 |
|
414 |
-
async def safe_predict(image):
|
415 |
try:
|
416 |
# ๅพ predict ๅฝๆธ่ฟๅ็ๅผๆธๆ่ฉฒ่ๆญค่ๅน้
|
417 |
-
prediction, annotated_img, buttons_options = await predict(image)
|
418 |
if buttons_options: # ๅฆๆๆๅค็็ตๆ๏ผ้กฏ็คบ้ธ้
ๆ้
|
419 |
-
return prediction, annotated_img, gr.update(visible=True, choices=buttons_options),
|
420 |
else: # ๅฎ็้ ๆธฌๆ้ฑ่ๆ้
|
421 |
-
return prediction, annotated_img, gr.update(visible=False),
|
422 |
except Exception as e:
|
423 |
return str(e), None, gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
|
424 |
|
|
|
425 |
input_image.change(
|
426 |
safe_predict,
|
427 |
inputs=input_image,
|
|
|
411 |
breed_buttons = gr.Radio([], label="Select breed for more details", visible=False)
|
412 |
breed_details = gr.Markdown(label="Breed Details")
|
413 |
|
414 |
+
async def safe_predict(image):
|
415 |
try:
|
416 |
# ๅพ predict ๅฝๆธ่ฟๅ็ๅผๆธๆ่ฉฒ่ๆญค่ๅน้
|
417 |
+
prediction, annotated_img, buttons_options, breed_details_visibility = await predict(image)
|
418 |
if buttons_options: # ๅฆๆๆๅค็็ตๆ๏ผ้กฏ็คบ้ธ้
ๆ้
|
419 |
+
return prediction, annotated_img, gr.update(visible=True, choices=buttons_options), breed_details_visibility
|
420 |
else: # ๅฎ็้ ๆธฌๆ้ฑ่ๆ้
|
421 |
+
return prediction, annotated_img, gr.update(visible=False), breed_details_visibility
|
422 |
except Exception as e:
|
423 |
return str(e), None, gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
|
424 |
|
425 |
+
|
426 |
input_image.change(
|
427 |
safe_predict,
|
428 |
inputs=input_image,
|