Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -241,9 +241,8 @@ async def process_single_dog(image):
|
|
241 |
"is_multi_dog": False
|
242 |
}
|
243 |
return breeds_info, image, initial_state
|
244 |
-
|
245 |
-
|
246 |
|
|
|
247 |
async def predict(image):
|
248 |
if image is None:
|
249 |
return "Please upload an image to start.", None, None
|
@@ -706,24 +705,7 @@ def show_details_html(choice, previous_output, initial_state):
|
|
706 |
error_msg = f"An error occurred while showing details: {e}"
|
707 |
print(error_msg)
|
708 |
return f"<p style='color: red;'>{error_msg}</p>", gr.update(visible=True), initial_state
|
709 |
-
|
710 |
-
|
711 |
-
# def format_description_html(description, breed):
|
712 |
-
# html = "<ul style='list-style-type: none; padding-left: 0;'>"
|
713 |
-
# if isinstance(description, dict):
|
714 |
-
# for key, value in description.items():
|
715 |
-
# # 跳過 Breed 資訊
|
716 |
-
# if key != "Breed":
|
717 |
-
# html += f"<li style='margin-bottom: 10px;'><strong>{key}:</strong> {value}</li>"
|
718 |
-
# elif isinstance(description, str):
|
719 |
-
# html += f"<li>{description}</li>"
|
720 |
-
# else:
|
721 |
-
# html += f"<li>No description available for {breed}</li>"
|
722 |
-
# html += "</ul>"
|
723 |
-
# akc_link = get_akc_breeds_link(breed)
|
724 |
-
# html += f'<p><a href="{akc_link}" target="_blank">Learn more about {breed} on the AKC website</a></p>'
|
725 |
-
# return html
|
726 |
-
|
727 |
|
728 |
def format_description_html(description, breed):
|
729 |
html = "<ul style='list-style-type: none; padding-left: 0;'>"
|
@@ -778,4 +760,4 @@ with gr.Blocks() as iface:
|
|
778 |
|
779 |
|
780 |
if __name__ == "__main__":
|
781 |
-
iface.launch()
|
|
|
241 |
"is_multi_dog": False
|
242 |
}
|
243 |
return breeds_info, image, initial_state
|
|
|
|
|
244 |
|
245 |
+
|
246 |
async def predict(image):
|
247 |
if image is None:
|
248 |
return "Please upload an image to start.", None, None
|
|
|
705 |
error_msg = f"An error occurred while showing details: {e}"
|
706 |
print(error_msg)
|
707 |
return f"<p style='color: red;'>{error_msg}</p>", gr.update(visible=True), initial_state
|
708 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
709 |
|
710 |
def format_description_html(description, breed):
|
711 |
html = "<ul style='list-style-type: none; padding-left: 0;'>"
|
|
|
760 |
|
761 |
|
762 |
if __name__ == "__main__":
|
763 |
+
iface.launch()
|