Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -708,20 +708,45 @@ def show_details_html(choice, previous_output, initial_state):
|
|
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 |
-
|
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'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
725 |
return html
|
726 |
|
727 |
|
|
|
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;'>"
|
730 |
if isinstance(description, dict):
|
731 |
for key, value in description.items():
|
732 |
+
if key != "Breed": # 跳過重複的品種顯示
|
|
|
733 |
html += f"<li style='margin-bottom: 10px;'><strong>{key}:</strong> {value}</li>"
|
734 |
elif isinstance(description, str):
|
735 |
html += f"<li>{description}</li>"
|
736 |
else:
|
737 |
html += f"<li>No description available for {breed}</li>"
|
738 |
html += "</ul>"
|
739 |
+
|
740 |
+
# 修改連結的生成方式
|
741 |
akc_link = get_akc_breeds_link(breed)
|
742 |
+
html += f'''
|
743 |
+
<div class="action-section">
|
744 |
+
<a href="{akc_link}" target="_blank" class="akc-button">
|
745 |
+
<span class="icon">🌐</span>
|
746 |
+
Learn more about {breed} on AKC website
|
747 |
+
</a>
|
748 |
+
</div>
|
749 |
+
'''
|
750 |
return html
|
751 |
|
752 |
|