DawnC commited on
Commit
8d9d3fa
1 Parent(s): dee9c35

Update html_templates.py

Browse files
Files changed (1) hide show
  1. html_templates.py +7 -4
html_templates.py CHANGED
@@ -216,6 +216,7 @@ def format_single_dog_result(breed: str, description: Dict[str, Any], color: str
216
  health_considerations.append(line[1:].strip())
217
  elif in_section == 'screenings':
218
  health_screenings.append(line[1:].strip())
 
219
 
220
  return f'''
221
  <div class="dog-info-card" style="background: {color}10;">
@@ -231,7 +232,7 @@ def format_single_dog_result(breed: str, description: Dict[str, Any], color: str
231
  font-weight: 600;
232
  font-size: 2.0em;
233
  letter-spacing: 0.5px;">
234
- {breed.replace('_', ' ')}
235
  </h2>
236
  </div>
237
 
@@ -436,7 +437,7 @@ def format_single_dog_result(breed: str, description: Dict[str, Any], color: str
436
  class="akc-button"
437
  style="display: inline-block; padding: 12px 24px; background: linear-gradient(90deg, #4299e1, #48bb78); color: white; text-decoration: none; border-radius: 6px;">
438
  <span class="icon">🌐</span>
439
- Learn more about {breed} on AKC website
440
  </a>
441
  </div>
442
  </div>
@@ -465,6 +466,8 @@ def format_multiple_breeds_result(
465
  get_dog_description: Callable
466
  ) -> str:
467
  """Format multiple breed predictions into HTML with complete information."""
 
 
468
  result = f'''
469
  <!-- 主標題區塊 -->
470
  <div style="background: {color}10; border-radius: 12px 12px 0 0; padding: 20px;">
@@ -540,7 +543,7 @@ def format_multiple_breeds_result(
540
  <div style="display: flex; align-items: center; gap: 14px;">
541
  <span style="font-size: 1.4em;">🐾</span>
542
  <h2 style="margin: 0; font-size: 1.8em; color: #1a202c; font-weight: 600;">
543
- {'Option ' + str(j+1) + ': ' if prob else ''}{breed}
544
  </h2>
545
  </div>
546
  {f'<span style="background: {color}12; color: {color}; padding: 8px 16px; border-radius: 8px; font-size: 1em; font-weight: 500; box-shadow: 0 1px 2px {color}20;">Confidence: {prob}</span>' if prob else ''}
@@ -928,7 +931,7 @@ def format_multiple_breeds_result(
928
  rel="noopener noreferrer"
929
  style="display: inline-flex; align-items: center; gap: 8px; padding: 14px 28px; background: linear-gradient(90deg, #4299e1, #48bb78); color: white; text-decoration: none; border-radius: 8px; font-weight: 500; transition: opacity 0.2s; box-shadow: 0 2px 4px rgba(0,0,0,0.1);">
930
  <span style="font-size: 1.2em;">🌐</span>
931
- Learn more about {breed} on AKC website
932
  </a>
933
  </div>
934
  </div>
 
216
  health_considerations.append(line[1:].strip())
217
  elif in_section == 'screenings':
218
  health_screenings.append(line[1:].strip())
219
+ display_breeds_name = breed.replace('_', ' ')
220
 
221
  return f'''
222
  <div class="dog-info-card" style="background: {color}10;">
 
232
  font-weight: 600;
233
  font-size: 2.0em;
234
  letter-spacing: 0.5px;">
235
+ {display_breeds_name}
236
  </h2>
237
  </div>
238
 
 
437
  class="akc-button"
438
  style="display: inline-block; padding: 12px 24px; background: linear-gradient(90deg, #4299e1, #48bb78); color: white; text-decoration: none; border-radius: 6px;">
439
  <span class="icon">🌐</span>
440
+ Learn more about {display_breeds_name} on AKC website
441
  </a>
442
  </div>
443
  </div>
 
466
  get_dog_description: Callable
467
  ) -> str:
468
  """Format multiple breed predictions into HTML with complete information."""
469
+ display_breeds = [breed.replace('_', ' ') for breed in topk_breeds]
470
+
471
  result = f'''
472
  <!-- 主標題區塊 -->
473
  <div style="background: {color}10; border-radius: 12px 12px 0 0; padding: 20px;">
 
543
  <div style="display: flex; align-items: center; gap: 14px;">
544
  <span style="font-size: 1.4em;">🐾</span>
545
  <h2 style="margin: 0; font-size: 1.8em; color: #1a202c; font-weight: 600;">
546
+ {'Option ' + str(j+1) + ': ' if prob else ''}{display_breeds}
547
  </h2>
548
  </div>
549
  {f'<span style="background: {color}12; color: {color}; padding: 8px 16px; border-radius: 8px; font-size: 1em; font-weight: 500; box-shadow: 0 1px 2px {color}20;">Confidence: {prob}</span>' if prob else ''}
 
931
  rel="noopener noreferrer"
932
  style="display: inline-flex; align-items: center; gap: 8px; padding: 14px 28px; background: linear-gradient(90deg, #4299e1, #48bb78); color: white; text-decoration: none; border-radius: 8px; font-weight: 500; transition: opacity 0.2s; box-shadow: 0 2px 4px rgba(0,0,0,0.1);">
933
  <span style="font-size: 1.2em;">🌐</span>
934
+ Learn more about {display_breeds} on AKC website
935
  </a>
936
  </div>
937
  </div>