DawnC commited on
Commit
cc9dff6
ยท
1 Parent(s): 1304379

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -324,11 +324,6 @@ async def predict(image):
324
  breed = topk_breeds[0]
325
  description = get_dog_description(breed)
326
  dogs_info += format_description_html(description, breed)
327
-
328
- # ๅœจๅ“็จฎๆ่ฟฐๅพŒๅŠ ๅ…ฅๆŒ‰้ˆ•
329
- button_id = f"Dog {i+1}: More about {breed}"
330
- buttons_html += f'<button style="display:block; margin-top:10px;" onclick="handle_button_click(\'{button_id}\')">{breed}</button>'
331
- dogs_info += buttons_html
332
 
333
  elif combined_confidence >= 0.15:
334
  dogs_info += f"<p>Top 3 possible breeds:</p><ul>"
@@ -339,17 +334,17 @@ async def predict(image):
339
  # ็‚บๆฏๅ€‹ๅ“็จฎๆ’ๅ…ฅๆŒ‰้ˆ•
340
  button_id = f"Dog {i+1}: More about {breed}"
341
  buttons_html += f'<button style="display:block; margin-top:10px;" onclick="handle_button_click(\'{button_id}\')">{breed}</button>'
342
-
343
  dogs_info += "</ul>"
344
- # ๅœจๆฏๅ€‹ๅ“็จฎๆ่ฟฐๅพŒๆ’ๅ…ฅๆŒ‰้ˆ•
345
- dogs_info += buttons_html # ็พๅœจ้€™ๆฎตๆ˜ฏ็›ดๆŽฅๆ”พๅœจๆฏๅ€‹ๅ“็จฎ็š„ๆ่ฟฐไน‹ๅพŒ
346
 
347
  else:
348
  dogs_info += "<p>The image is unclear or the breed is not in the dataset. Please upload a clearer image.</p>"
349
 
350
  dogs_info += '</div>' # ็ตๆŸ็•ถๅ‰็‹—็š„่ณ‡่จŠๅ€ๅกŠ
351
 
352
- # ไธๅ†็”Ÿๆˆ็ตฑไธ€็š„ๆŒ‰้ˆ•้›†๏ผŒ่€Œๆ˜ฏๆฏๅ€‹ๅ“็จฎ่‡ช่กŒ็ฎก็†ๆŒ‰้ˆ•
353
  html_output = f"""
354
  <style>
355
  .dog-info {{ border: 1px solid #ddd; margin-bottom: 20px; padding: 15px; border-radius: 5px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }}
@@ -357,6 +352,7 @@ async def predict(image):
357
  {dogs_info}
358
  """
359
 
 
360
 
361
 
362
  if buttons:
 
324
  breed = topk_breeds[0]
325
  description = get_dog_description(breed)
326
  dogs_info += format_description_html(description, breed)
 
 
 
 
 
327
 
328
  elif combined_confidence >= 0.15:
329
  dogs_info += f"<p>Top 3 possible breeds:</p><ul>"
 
334
  # ็‚บๆฏๅ€‹ๅ“็จฎๆ’ๅ…ฅๆŒ‰้ˆ•
335
  button_id = f"Dog {i+1}: More about {breed}"
336
  buttons_html += f'<button style="display:block; margin-top:10px;" onclick="handle_button_click(\'{button_id}\')">{breed}</button>'
337
+
338
  dogs_info += "</ul>"
339
+ # ็ขบไฟๅชๅœจ้€™ๅ€‹ๆขไปถไธ‹้กฏ็คบๆŒ‰้ˆ•
340
+ dogs_info += f'<div>{buttons_html}</div>'
341
 
342
  else:
343
  dogs_info += "<p>The image is unclear or the breed is not in the dataset. Please upload a clearer image.</p>"
344
 
345
  dogs_info += '</div>' # ็ตๆŸ็•ถๅ‰็‹—็š„่ณ‡่จŠๅ€ๅกŠ
346
 
347
+ # ๆœ€็ต‚็”Ÿๆˆ็š„ HTML ่ผธๅ‡บ
348
  html_output = f"""
349
  <style>
350
  .dog-info {{ border: 1px solid #ddd; margin-bottom: 20px; padding: 15px; border-radius: 5px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }}
 
352
  {dogs_info}
353
  """
354
 
355
+
356
 
357
 
358
  if buttons: