Mahdi Naser Moghadasi commited on
Commit
53ebb28
Β·
1 Parent(s): 0cc1ca4

πŸ”§ Fix Albert avatar size (5x larger) and voice button (smaller + working functionality)

Browse files
Files changed (1) hide show
  1. app.py +28 -14
app.py CHANGED
@@ -1384,12 +1384,12 @@ with gr.Blocks(
1384
  }
1385
 
1386
  .chatbot .message .avatar {
1387
- width: 60px !important;
1388
- height: 60px !important;
1389
  border-radius: 50% !important;
1390
- margin-right: 15px !important;
1391
- border: 4px solid #667eea !important;
1392
- box-shadow: 0 6px 12px rgba(0,0,0,0.2) !important;
1393
  transition: all 0.3s ease !important;
1394
  }
1395
 
@@ -1421,12 +1421,12 @@ with gr.Blocks(
1421
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%) !important;
1422
  color: white !important;
1423
  border: none !important;
1424
- padding: 12px 20px !important;
1425
- border-radius: 8px !important;
1426
  cursor: pointer !important;
1427
- font-weight: 600 !important;
1428
- font-size: 14px !important;
1429
- box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3) !important;
1430
  transition: all 0.3s ease !important;
1431
  }
1432
 
@@ -1434,6 +1434,20 @@ with gr.Blocks(
1434
  transform: translateY(-2px) !important;
1435
  box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4) !important;
1436
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1437
  """
1438
  ) as demo:
1439
 
@@ -1690,9 +1704,9 @@ with gr.Blocks(
1690
  voice_html = f"""
1691
  <div class="voice-controls">
1692
  <button onclick="speakText('{escaped_response}')">
1693
- πŸ”Š Listen to Albert
1694
  </button>
1695
- <span style="color: #666; font-size: 12px; margin-left: 10px;">Click to hear Albert speak!</span>
1696
  </div>
1697
  <script>
1698
  function speakText(text) {{
@@ -1730,9 +1744,9 @@ with gr.Blocks(
1730
  voice_html = f"""
1731
  <div class="voice-controls">
1732
  <button onclick="speakText('{escaped_response}')">
1733
- πŸ”Š Listen to Albert
1734
  </button>
1735
- <span style="color: #666; font-size: 12px; margin-left: 10px;">Click to hear Albert speak!</span>
1736
  </div>
1737
  <script>
1738
  function speakText(text) {{
 
1384
  }
1385
 
1386
  .chatbot .message .avatar {
1387
+ width: 300px !important;
1388
+ height: 300px !important;
1389
  border-radius: 50% !important;
1390
+ margin-right: 20px !important;
1391
+ border: 6px solid #667eea !important;
1392
+ box-shadow: 0 8px 16px rgba(0,0,0,0.3) !important;
1393
  transition: all 0.3s ease !important;
1394
  }
1395
 
 
1421
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%) !important;
1422
  color: white !important;
1423
  border: none !important;
1424
+ padding: 6px 12px !important;
1425
+ border-radius: 6px !important;
1426
  cursor: pointer !important;
1427
+ font-weight: 500 !important;
1428
+ font-size: 11px !important;
1429
+ box-shadow: 0 2px 6px rgba(76, 175, 80, 0.3) !important;
1430
  transition: all 0.3s ease !important;
1431
  }
1432
 
 
1434
  transform: translateY(-2px) !important;
1435
  box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4) !important;
1436
  }
1437
+ </style>
1438
+ <script>
1439
+ function speakText(text) {
1440
+ if ('speechSynthesis' in window) {
1441
+ const utterance = new SpeechSynthesisUtterance(text);
1442
+ utterance.rate = 0.9;
1443
+ utterance.pitch = 1.1;
1444
+ utterance.volume = 0.8;
1445
+ speechSynthesis.speak(utterance);
1446
+ } else {
1447
+ alert('Speech synthesis not supported in this browser');
1448
+ }
1449
+ }
1450
+ </script>
1451
  """
1452
  ) as demo:
1453
 
 
1704
  voice_html = f"""
1705
  <div class="voice-controls">
1706
  <button onclick="speakText('{escaped_response}')">
1707
+ πŸ”Š Listen
1708
  </button>
1709
+ <span style="color: #666; font-size: 10px; margin-left: 8px;">Click to hear Albert!</span>
1710
  </div>
1711
  <script>
1712
  function speakText(text) {{
 
1744
  voice_html = f"""
1745
  <div class="voice-controls">
1746
  <button onclick="speakText('{escaped_response}')">
1747
+ πŸ”Š Listen
1748
  </button>
1749
+ <span style="color: #666; font-size: 10px; margin-left: 8px;">Click to hear Albert!</span>
1750
  </div>
1751
  <script>
1752
  function speakText(text) {{