Spaces:
Paused
Paused
Update tts_elevenlabs.py
Browse files- tts_elevenlabs.py +12 -1
tts_elevenlabs.py
CHANGED
|
@@ -69,9 +69,20 @@ class ElevenLabsTTS(TTSInterface):
|
|
| 69 |
)
|
| 70 |
|
| 71 |
response.raise_for_status()
|
| 72 |
-
audio_data = response.content
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
log_debug(f"✅ ElevenLabs TTS returned {len(audio_data)} bytes")
|
|
|
|
|
|
|
| 75 |
return audio_data
|
| 76 |
|
| 77 |
except httpx.HTTPStatusError as e:
|
|
|
|
| 69 |
)
|
| 70 |
|
| 71 |
response.raise_for_status()
|
| 72 |
+
audio_data = response.content # This should be bytes
|
| 73 |
+
|
| 74 |
+
# Ensure we're returning bytes
|
| 75 |
+
if isinstance(audio_data, str):
|
| 76 |
+
log_warning("ElevenLabs returned string instead of bytes")
|
| 77 |
+
# Try to decode if it's base64
|
| 78 |
+
try:
|
| 79 |
+
audio_data = base64.b64decode(audio_data)
|
| 80 |
+
except:
|
| 81 |
+
pass
|
| 82 |
|
| 83 |
log_debug(f"✅ ElevenLabs TTS returned {len(audio_data)} bytes")
|
| 84 |
+
log_debug(f"Audio data type: {type(audio_data)}")
|
| 85 |
+
|
| 86 |
return audio_data
|
| 87 |
|
| 88 |
except httpx.HTTPStatusError as e:
|