Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -413,7 +413,12 @@ with gr.Blocks(css="""
|
|
413 |
|
414 |
async def safe_predict(image):
|
415 |
try:
|
416 |
-
|
|
|
|
|
|
|
|
|
|
|
417 |
except Exception as e:
|
418 |
return str(e), None, gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
|
419 |
|
@@ -434,6 +439,7 @@ with gr.Blocks(css="""
|
|
434 |
inputs=input_image
|
435 |
)
|
436 |
|
|
|
437 |
gr.HTML('For more details on this project and other work, feel free to visit my GitHub <a href="https://github.com/Eric-Chung-0511/Learning-Record/tree/main/Data%20Science%20Projects/Dog_Breed_Classifier">Dog Breed Classifier</a>')
|
438 |
|
439 |
if __name__ == "__main__":
|
|
|
413 |
|
414 |
async def safe_predict(image):
|
415 |
try:
|
416 |
+
# ๅพ predict ๅฝๆธ่ฟๅ 4 ๅ็ตๆ
|
417 |
+
prediction, annotated_img, buttons_options, breed_detail = await predict(image)
|
418 |
+
if buttons_options: # ๅฆๆๆๅค็็ตๆ๏ผ้กฏ็คบ้ธ้
ๆ้
|
419 |
+
return prediction, annotated_img, gr.update(visible=True, choices=buttons_options), breed_detail
|
420 |
+
else: # ๅฎ็้ ๆธฌๆ้ฑ่ๆ้
|
421 |
+
return prediction, annotated_img, gr.update(visible=False), breed_detail
|
422 |
except Exception as e:
|
423 |
return str(e), None, gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
|
424 |
|
|
|
439 |
inputs=input_image
|
440 |
)
|
441 |
|
442 |
+
|
443 |
gr.HTML('For more details on this project and other work, feel free to visit my GitHub <a href="https://github.com/Eric-Chung-0511/Learning-Record/tree/main/Data%20Science%20Projects/Dog_Breed_Classifier">Dog Breed Classifier</a>')
|
444 |
|
445 |
if __name__ == "__main__":
|