Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -178,15 +178,17 @@ def generate_script(prompt, max_length=150):
|
|
178 |
logger.warning("Usando prompt original como guion debido al error de generación.")
|
179 |
return prompt.strip()
|
180 |
|
|
|
|
|
181 |
def text_to_speech(text, output_path, voice=None):
|
182 |
-
logger.info(f"Convirtiendo texto a voz | Caracteres: {len(text)} | Salida: {output_path}")
|
183 |
if not text or not text.strip():
|
184 |
logger.warning("Texto vacío para TTS")
|
185 |
return False
|
186 |
|
187 |
try:
|
188 |
-
# Usar un modelo ligero
|
189 |
-
tts = TTS(model_name="tts_models/es/
|
190 |
|
191 |
# Limpiar y truncar texto
|
192 |
text = re.sub(r'[^\w\s.,!?áéíóúñÁÉÍÓÚÑ]', '', text)
|
|
|
178 |
logger.warning("Usando prompt original como guion debido al error de generación.")
|
179 |
return prompt.strip()
|
180 |
|
181 |
+
from TTS.api import TTS
|
182 |
+
|
183 |
def text_to_speech(text, output_path, voice=None):
|
184 |
+
logger.info(f"Convirtiendo texto a voz con Coqui TTS | Caracteres: {len(text)} | Salida: {output_path}")
|
185 |
if not text or not text.strip():
|
186 |
logger.warning("Texto vacío para TTS")
|
187 |
return False
|
188 |
|
189 |
try:
|
190 |
+
# Usar un modelo ligero y confirmado Ascoltado para español
|
191 |
+
tts = TTS(model_name="tts_models/es/css10/vits", progress_bar=False, gpu=False)
|
192 |
|
193 |
# Limpiar y truncar texto
|
194 |
text = re.sub(r'[^\w\s.,!?áéíóúñÁÉÍÓÚÑ]', '', text)
|