Spaces:
Building
Building
Update tts_google.py
Browse files- tts_google.py +4 -3
tts_google.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
# tts_google.py
|
2 |
from google.cloud import texttospeech
|
3 |
from ssml_converter import SSMLConverter
|
|
|
4 |
|
5 |
class GoogleCloudTTS(TTSInterface):
|
6 |
"""Google Cloud Text-to-Speech implementation"""
|
@@ -29,7 +30,7 @@ class GoogleCloudTTS(TTSInterface):
|
|
29 |
if use_ssml and not text.startswith("<speak>"):
|
30 |
# Convert to SSML
|
31 |
text = self.ssml_converter.convert_to_ssml(text)
|
32 |
-
|
33 |
input_text = texttospeech.SynthesisInput(ssml=text)
|
34 |
else:
|
35 |
input_text = texttospeech.SynthesisInput(text=text)
|
@@ -56,9 +57,9 @@ class GoogleCloudTTS(TTSInterface):
|
|
56 |
audio_config=audio_config
|
57 |
)
|
58 |
|
59 |
-
|
60 |
return response.audio_content
|
61 |
|
62 |
except Exception as e:
|
63 |
-
|
64 |
raise
|
|
|
1 |
# tts_google.py
|
2 |
from google.cloud import texttospeech
|
3 |
from ssml_converter import SSMLConverter
|
4 |
+
from logger import log_info, log_error, log_debug, log_warning
|
5 |
|
6 |
class GoogleCloudTTS(TTSInterface):
|
7 |
"""Google Cloud Text-to-Speech implementation"""
|
|
|
30 |
if use_ssml and not text.startswith("<speak>"):
|
31 |
# Convert to SSML
|
32 |
text = self.ssml_converter.convert_to_ssml(text)
|
33 |
+
log_info(f"π Converted to SSML: {text[:200]}...")
|
34 |
input_text = texttospeech.SynthesisInput(ssml=text)
|
35 |
else:
|
36 |
input_text = texttospeech.SynthesisInput(text=text)
|
|
|
57 |
audio_config=audio_config
|
58 |
)
|
59 |
|
60 |
+
log_info(f"β
Google TTS returned {len(response.audio_content)} bytes")
|
61 |
return response.audio_content
|
62 |
|
63 |
except Exception as e:
|
64 |
+
log_error("β Google TTS error", e)
|
65 |
raise
|