Spaces:
Running
on
Zero
Running
on
Zero
Update html_templates.py
Browse files- html_templates.py +8 -5
html_templates.py
CHANGED
|
@@ -22,7 +22,7 @@ def get_akc_breeds_link(breed: str) -> str:
|
|
| 22 |
|
| 23 |
def get_color_scheme(is_single_dog: bool) -> Union[str, List[str]]:
|
| 24 |
"""Get color scheme for dog detection visualization."""
|
| 25 |
-
single_dog_color = '#34C759' #
|
| 26 |
color_list = [
|
| 27 |
'#FF5733', # 珊瑚紅
|
| 28 |
'#28A745', # 深綠色
|
|
@@ -108,6 +108,7 @@ def format_not_dog_message(color: str, index: int) -> str:
|
|
| 108 |
</div>
|
| 109 |
'''
|
| 110 |
|
|
|
|
| 111 |
def format_description_html(description: Dict[str, Any], breed: str) -> str:
|
| 112 |
"""Format basic breed description with tooltips."""
|
| 113 |
if not isinstance(description, dict):
|
|
@@ -134,6 +135,7 @@ def format_description_html(description: Dict[str, Any], breed: str) -> str:
|
|
| 134 |
return f'<ul style="list-style-type: none; padding-left: 0;">{" ".join(html_parts)}</ul>'
|
| 135 |
|
| 136 |
|
|
|
|
| 137 |
def format_tooltip(key: str, value: str) -> str:
|
| 138 |
"""Format tooltip with content for each field."""
|
| 139 |
tooltip_contents = {
|
|
@@ -403,7 +405,7 @@ def format_single_dog_result(breed: str, description: Dict[str, Any], color: str
|
|
| 403 |
{format_noise_items(barking_triggers)}
|
| 404 |
</div>
|
| 405 |
<div class="disclaimer-section" style="margin-top: 15px; font-size: 0.9em; color: #666;">
|
| 406 |
-
<p class="disclaimer-text source-text">Source: Compiled from various breed behavior resources,
|
| 407 |
<p class="disclaimer-text">Individual dogs may vary in their vocalization patterns.</p>
|
| 408 |
<p class="disclaimer-text">Training can significantly influence barking behavior.</p>
|
| 409 |
<p class="disclaimer-text">Environmental factors may affect noise levels.</p>
|
|
@@ -446,7 +448,7 @@ def format_single_dog_result(breed: str, description: Dict[str, Any], color: str
|
|
| 446 |
{format_health_items(health_screenings)}
|
| 447 |
</div>
|
| 448 |
<div class="disclaimer-section" style="margin-top: 15px; font-size: 0.9em; color: #666;">
|
| 449 |
-
<p class="disclaimer-text source-text">Source: Compiled from various veterinary and breed information resources,
|
| 450 |
<p class="disclaimer-text">This information is for reference only and based on breed tendencies.</p>
|
| 451 |
<p class="disclaimer-text">Each dog is unique and may not develop any or all of these conditions.</p>
|
| 452 |
<p class="disclaimer-text">Always consult with qualified veterinarians for professional advice.</p>
|
|
@@ -860,7 +862,7 @@ def format_multiple_breeds_result(
|
|
| 860 |
{format_noise_items(barking_triggers)}
|
| 861 |
</div>
|
| 862 |
<div style="margin-top: 20px; padding-top: 16px; border-top: 1px solid #e2e8f0;">
|
| 863 |
-
<p style="margin: 0 0 8px 0; color: #4a5568; font-size: 0.9em;">Source: Compiled from various breed behavior resources,
|
| 864 |
<p style="margin: 0 0 8px 0; color: #4a5568; font-size: 0.9em;">Individual dogs may vary in their vocalization patterns.</p>
|
| 865 |
<p style="margin: 0 0 8px 0; color: #4a5568; font-size: 0.9em;">Training can significantly influence barking behavior.</p>
|
| 866 |
<p style="margin: 0 0 8px 0; color: #4a5568; font-size: 0.9em;">Environmental factors may affect noise levels.</p>
|
|
@@ -927,7 +929,7 @@ def format_multiple_breeds_result(
|
|
| 927 |
{format_health_items(health_screenings)}
|
| 928 |
</div>
|
| 929 |
<div style="margin-top: 20px; padding-top: 16px; border-top: 1px solid #e2e8f0;">
|
| 930 |
-
<p style="margin: 0 0 8px 0; color: #4a5568; font-size: 0.9em;">Source: Compiled from veterinary resources and breed health studies,
|
| 931 |
<p style="margin: 0 0 8px 0; color: #4a5568; font-size: 0.9em;">Regular vet check-ups are essential for all breeds.</p>
|
| 932 |
<p style="margin: 0 0 8px 0; color: #4a5568; font-size: 0.9em;">Early detection and prevention are key to managing health issues.</p>
|
| 933 |
<p style="margin: 0 0 8px 0; color: #4a5568; font-size: 0.9em;">Not all dogs will develop these conditions.</p>
|
|
@@ -972,6 +974,7 @@ def format_multi_dog_container(dogs_info: str) -> str:
|
|
| 972 |
</div>
|
| 973 |
"""
|
| 974 |
|
|
|
|
| 975 |
def format_breed_details_html(description: Dict[str, Any], breed: str) -> str:
|
| 976 |
"""Format breed details for the show_details_html function."""
|
| 977 |
return f"""
|
|
|
|
| 22 |
|
| 23 |
def get_color_scheme(is_single_dog: bool) -> Union[str, List[str]]:
|
| 24 |
"""Get color scheme for dog detection visualization."""
|
| 25 |
+
single_dog_color = '#34C759' # 亮綠色作為辨識一隻狗的默認顏色
|
| 26 |
color_list = [
|
| 27 |
'#FF5733', # 珊瑚紅
|
| 28 |
'#28A745', # 深綠色
|
|
|
|
| 108 |
</div>
|
| 109 |
'''
|
| 110 |
|
| 111 |
+
# 特性分類
|
| 112 |
def format_description_html(description: Dict[str, Any], breed: str) -> str:
|
| 113 |
"""Format basic breed description with tooltips."""
|
| 114 |
if not isinstance(description, dict):
|
|
|
|
| 135 |
return f'<ul style="list-style-type: none; padding-left: 0;">{" ".join(html_parts)}</ul>'
|
| 136 |
|
| 137 |
|
| 138 |
+
# 提示氣泡
|
| 139 |
def format_tooltip(key: str, value: str) -> str:
|
| 140 |
"""Format tooltip with content for each field."""
|
| 141 |
tooltip_contents = {
|
|
|
|
| 405 |
{format_noise_items(barking_triggers)}
|
| 406 |
</div>
|
| 407 |
<div class="disclaimer-section" style="margin-top: 15px; font-size: 0.9em; color: #666;">
|
| 408 |
+
<p class="disclaimer-text source-text">Source: Compiled from various breed behavior resources, 2025</p>
|
| 409 |
<p class="disclaimer-text">Individual dogs may vary in their vocalization patterns.</p>
|
| 410 |
<p class="disclaimer-text">Training can significantly influence barking behavior.</p>
|
| 411 |
<p class="disclaimer-text">Environmental factors may affect noise levels.</p>
|
|
|
|
| 448 |
{format_health_items(health_screenings)}
|
| 449 |
</div>
|
| 450 |
<div class="disclaimer-section" style="margin-top: 15px; font-size: 0.9em; color: #666;">
|
| 451 |
+
<p class="disclaimer-text source-text">Source: Compiled from various veterinary and breed information resources, 2025</p>
|
| 452 |
<p class="disclaimer-text">This information is for reference only and based on breed tendencies.</p>
|
| 453 |
<p class="disclaimer-text">Each dog is unique and may not develop any or all of these conditions.</p>
|
| 454 |
<p class="disclaimer-text">Always consult with qualified veterinarians for professional advice.</p>
|
|
|
|
| 862 |
{format_noise_items(barking_triggers)}
|
| 863 |
</div>
|
| 864 |
<div style="margin-top: 20px; padding-top: 16px; border-top: 1px solid #e2e8f0;">
|
| 865 |
+
<p style="margin: 0 0 8px 0; color: #4a5568; font-size: 0.9em;">Source: Compiled from various breed behavior resources, 2025</p>
|
| 866 |
<p style="margin: 0 0 8px 0; color: #4a5568; font-size: 0.9em;">Individual dogs may vary in their vocalization patterns.</p>
|
| 867 |
<p style="margin: 0 0 8px 0; color: #4a5568; font-size: 0.9em;">Training can significantly influence barking behavior.</p>
|
| 868 |
<p style="margin: 0 0 8px 0; color: #4a5568; font-size: 0.9em;">Environmental factors may affect noise levels.</p>
|
|
|
|
| 929 |
{format_health_items(health_screenings)}
|
| 930 |
</div>
|
| 931 |
<div style="margin-top: 20px; padding-top: 16px; border-top: 1px solid #e2e8f0;">
|
| 932 |
+
<p style="margin: 0 0 8px 0; color: #4a5568; font-size: 0.9em;">Source: Compiled from veterinary resources and breed health studies, 2025</p>
|
| 933 |
<p style="margin: 0 0 8px 0; color: #4a5568; font-size: 0.9em;">Regular vet check-ups are essential for all breeds.</p>
|
| 934 |
<p style="margin: 0 0 8px 0; color: #4a5568; font-size: 0.9em;">Early detection and prevention are key to managing health issues.</p>
|
| 935 |
<p style="margin: 0 0 8px 0; color: #4a5568; font-size: 0.9em;">Not all dogs will develop these conditions.</p>
|
|
|
|
| 974 |
</div>
|
| 975 |
"""
|
| 976 |
|
| 977 |
+
# AKC Link
|
| 978 |
def format_breed_details_html(description: Dict[str, Any], breed: str) -> str:
|
| 979 |
"""Format breed details for the show_details_html function."""
|
| 980 |
return f"""
|