Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -410,17 +410,15 @@ with gr.Blocks(css="""
|
|
410 |
breed_buttons = gr.Radio([], label="Select breed for more details", visible=False)
|
411 |
breed_details = gr.Markdown(label="Breed Details")
|
412 |
|
413 |
-
def
|
414 |
-
|
|
|
|
|
|
|
415 |
|
416 |
input_image.change(
|
417 |
-
|
418 |
inputs=input_image,
|
419 |
-
outputs=[output, output_image, breed_buttons, breed_details],
|
420 |
-
api_name="predict"
|
421 |
-
).catch(
|
422 |
-
fn=handle_error,
|
423 |
-
inputs=None,
|
424 |
outputs=[output, output_image, breed_buttons, breed_details]
|
425 |
)
|
426 |
|
|
|
410 |
breed_buttons = gr.Radio([], label="Select breed for more details", visible=False)
|
411 |
breed_details = gr.Markdown(label="Breed Details")
|
412 |
|
413 |
+
async def safe_predict(image):
|
414 |
+
try:
|
415 |
+
return await predict(image)
|
416 |
+
except Exception as e:
|
417 |
+
return str(e), None, gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
|
418 |
|
419 |
input_image.change(
|
420 |
+
safe_predict,
|
421 |
inputs=input_image,
|
|
|
|
|
|
|
|
|
|
|
422 |
outputs=[output, output_image, breed_buttons, breed_details]
|
423 |
)
|
424 |
|