jeevzz commited on
Commit
1f9ba91
·
verified ·
1 Parent(s): aef1e37

Update voice.py

Browse files
Files changed (1) hide show
  1. voice.py +8 -1
voice.py CHANGED
@@ -10,6 +10,10 @@ async def generate_audio(text: str, voice: str) -> str:
10
  Generate audio using Microsoft Edge TTS with high-quality neural voices
11
  """
12
  try:
 
 
 
 
13
  # Create a temporary file with .mp3 extension
14
  fd, path = tempfile.mkstemp(suffix=".mp3")
15
  os.close(fd)
@@ -22,6 +26,9 @@ async def generate_audio(text: str, voice: str) -> str:
22
 
23
  except Exception as e:
24
  print(f"TTS Failed: {e}")
 
 
 
25
  raise e
26
 
27
  def get_voices():
@@ -54,4 +61,4 @@ def get_voices():
54
 
55
  # 🇮🇪 Irish Accent - Charming
56
  {"name": "☘️ Emily (Irish Charm)", "id": "en-IE-EmilyNeural"},
57
- ]
 
10
  Generate audio using Microsoft Edge TTS with high-quality neural voices
11
  """
12
  try:
13
+ print(f"Generating audio for voice: {voice}, text length: {len(text)}")
14
+ if not text:
15
+ raise ValueError("Text is empty")
16
+
17
  # Create a temporary file with .mp3 extension
18
  fd, path = tempfile.mkstemp(suffix=".mp3")
19
  os.close(fd)
 
26
 
27
  except Exception as e:
28
  print(f"TTS Failed: {e}")
29
+ # Print full traceback for debugging
30
+ import traceback
31
+ traceback.print_exc()
32
  raise e
33
 
34
  def get_voices():
 
61
 
62
  # 🇮🇪 Irish Accent - Charming
63
  {"name": "☘️ Emily (Irish Charm)", "id": "en-IE-EmilyNeural"},
64
+ ]