Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -63,7 +63,7 @@ async def get_voices():
|
|
63 |
|
64 |
async def generate_audio_with_voice_prefix(text_segment, default_voice, rate, pitch):
|
65 |
"""Generates audio for a text segment, handling voice prefixes, retries, and fallback."""
|
66 |
-
|
67 |
voice_map = {
|
68 |
"1F": ("en-GB-SoniaNeural", 25, 0),
|
69 |
"2F": ("en-US-JennyNeural", 0, 0),
|
@@ -126,6 +126,7 @@ async def generate_audio_with_voice_prefix(text_segment, default_voice, rate, pi
|
|
126 |
audio.export(stripped_path, format="mp3")
|
127 |
return stripped_path
|
128 |
except Exception as e:
|
|
|
129 |
if attempt == 2:
|
130 |
# Final failure: return 500ms of silence
|
131 |
silent_audio = AudioSegment.silent(duration=500)
|
|
|
63 |
|
64 |
async def generate_audio_with_voice_prefix(text_segment, default_voice, rate, pitch):
|
65 |
"""Generates audio for a text segment, handling voice prefixes, retries, and fallback."""
|
66 |
+
print(f"Text: {text_segment}") #Debug
|
67 |
voice_map = {
|
68 |
"1F": ("en-GB-SoniaNeural", 25, 0),
|
69 |
"2F": ("en-US-JennyNeural", 0, 0),
|
|
|
126 |
audio.export(stripped_path, format="mp3")
|
127 |
return stripped_path
|
128 |
except Exception as e:
|
129 |
+
print(f"Edge TTS Failed# {attempt}:: {e}") #Debug
|
130 |
if attempt == 2:
|
131 |
# Final failure: return 500ms of silence
|
132 |
silent_audio = AudioSegment.silent(duration=500)
|