gnosticdev commited on
Commit
5ca1550
·
verified ·
1 Parent(s): 0504374

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -11
app.py CHANGED
@@ -364,21 +364,17 @@ async def crear_video_async(prompt_type, input_text, selected_voice, musica_file
364
 
365
  # 2. Generar audio de voz
366
  voz_path = os.path.join(temp_dir_intermediate, "voz.mp3")
367
- tts_voices_to_try = [selected_voice, "es-ES-JuanNeural", "es-ES-ElviraNeural"]
368
  tts_success = False
369
- tried_voices = set()
370
 
371
- for current_voice in tts_voices_to_try:
372
- if current_voice in tried_voices or not current_voice:
373
- continue
374
- tried_voices.add(current_voice)
375
- logger.info(f"Intentando TTS con voz: {current_voice}...")
376
- tts_success = await text_to_speech(guion, voz_path, current_voice)
377
- if tts_success:
378
- break
379
 
380
  if not tts_success or not os.path.exists(voz_path) or os.path.getsize(voz_path) <= 100:
381
- raise ValueError("Error generando voz a partir del guion.")
382
 
383
  temp_intermediate_files.append(voz_path)
384
  audio_tts_original = AudioFileClip(voz_path)
 
364
 
365
  # 2. Generar audio de voz
366
  voz_path = os.path.join(temp_dir_intermediate, "voz.mp3")
367
+ tts_voices_to_try = [selected_voice] # Solo intentar la voz seleccionada
368
  tts_success = False
 
369
 
370
+ logger.info(f"Intentando TTS con voz seleccionada: {selected_voice}")
371
+ tts_success = await text_to_speech(guion, voz_path, selected_voice)
372
+ if not tts_success:
373
+ logger.warning(f"Fallo con voz '{selected_voice}'. Intentando voz por defecto: {DEFAULT_VOICE_ID}")
374
+ tts_success = await text_to_speech(guion, voz_path, DEFAULT_VOICE_ID)
 
 
 
375
 
376
  if not tts_success or not os.path.exists(voz_path) or os.path.getsize(voz_path) <= 100:
377
+ raise ValueError(f"Error generando voz. Intentos con '{selected_voice}' y '{DEFAULT_VOICE_ID}' fallaron.")
378
 
379
  temp_intermediate_files.append(voz_path)
380
  audio_tts_original = AudioFileClip(voz_path)