DawnC commited on
Commit
25f1bec
ยท
1 Parent(s): 65fb0be

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -412,6 +412,7 @@ def _detect_multiple_dogs(image, conf_threshold):
412
  # if __name__ == "__main__":
413
  # iface.launch()
414
 
 
415
  async def predict(image):
416
  if image is None:
417
  return "Please upload an image to start.", None, gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
@@ -490,6 +491,18 @@ async def process_single_dog(image):
490
  gr.update(visible=True, value=f"More about {topk_breeds[1]}"),
491
  gr.update(visible=True, value=f"More about {topk_breeds[2]}"))
492
 
 
 
 
 
 
 
 
 
 
 
 
 
493
  # ไป‹้ข้ƒจๅˆ†
494
  with gr.Blocks() as iface:
495
  gr.HTML("<h1 style='text-align: center;'>๐Ÿถ Dog Breed Classifier ๐Ÿ”</h1>")
 
412
  # if __name__ == "__main__":
413
  # iface.launch()
414
 
415
+
416
  async def predict(image):
417
  if image is None:
418
  return "Please upload an image to start.", None, gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
 
491
  gr.update(visible=True, value=f"More about {topk_breeds[1]}"),
492
  gr.update(visible=True, value=f"More about {topk_breeds[2]}"))
493
 
494
+
495
+ def show_details(choice):
496
+ if not choice:
497
+ return "Please select a breed to view details."
498
+
499
+ try:
500
+ breed = choice.split("More about ")[-1]
501
+ description = get_dog_description(breed)
502
+ return format_description(description, breed)
503
+ except Exception as e:
504
+ return f"An error occurred while showing details: {e}"
505
+
506
  # ไป‹้ข้ƒจๅˆ†
507
  with gr.Blocks() as iface:
508
  gr.HTML("<h1 style='text-align: center;'>๐Ÿถ Dog Breed Classifier ๐Ÿ”</h1>")