Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
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:
|