Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -566,7 +566,7 @@ async def run_app_async(prompt_type, prompt_ia, prompt_manual, musica_file, sele
|
|
| 566 |
input_text = prompt_ia if prompt_type == "Generar Guion con IA" else prompt_manual
|
| 567 |
output_video = None
|
| 568 |
output_file = None
|
| 569 |
-
status_msg = gr.update(value="⏳ Procesando...")
|
| 570 |
|
| 571 |
if not input_text or not input_text.strip():
|
| 572 |
logger.warning("Texto de entrada vacío.")
|
|
@@ -578,20 +578,25 @@ async def run_app_async(prompt_type, prompt_ia, prompt_manual, musica_file, sele
|
|
| 578 |
selected_voice = DEFAULT_VOICE_ID
|
| 579 |
|
| 580 |
try:
|
|
|
|
| 581 |
video_path = await crear_video_async(prompt_type, input_text, selected_voice, musica_file)
|
| 582 |
if video_path and os.path.exists(video_path):
|
| 583 |
output_video = video_path
|
| 584 |
output_file = video_path
|
| 585 |
-
status_msg = gr.update(value="✅ Video generado exitosamente. Descarga disponible en
|
|
|
|
| 586 |
else:
|
| 587 |
status_msg = gr.update(value="❌ Error: Falló la generación del video.")
|
|
|
|
| 588 |
except ValueError as ve:
|
| 589 |
logger.warning(f"Error de validación: {str(ve)}")
|
| 590 |
status_msg = gr.update(value=f"⚠️ Error: {str(ve)}")
|
| 591 |
except Exception as e:
|
| 592 |
logger.critical(f"Error crítico: {str(e)}")
|
| 593 |
status_msg = gr.update(value=f"❌ Error inesperado: {str(e)}")
|
| 594 |
-
|
|
|
|
|
|
|
| 595 |
|
| 596 |
def run_app(prompt_type, prompt_ia, prompt_manual, musica_file, selected_voice):
|
| 597 |
return asyncio.run(run_app_async(prompt_type, prompt_ia, prompt_manual, musica_file, selected_voice))
|
|
|
|
| 566 |
input_text = prompt_ia if prompt_type == "Generar Guion con IA" else prompt_manual
|
| 567 |
output_video = None
|
| 568 |
output_file = None
|
| 569 |
+
status_msg = gr.update(value="⏳ Procesando... Esto puede tomar hasta 1 hora.")
|
| 570 |
|
| 571 |
if not input_text or not input_text.strip():
|
| 572 |
logger.warning("Texto de entrada vacío.")
|
|
|
|
| 578 |
selected_voice = DEFAULT_VOICE_ID
|
| 579 |
|
| 580 |
try:
|
| 581 |
+
logger.info("Iniciando generación de video...")
|
| 582 |
video_path = await crear_video_async(prompt_type, input_text, selected_voice, musica_file)
|
| 583 |
if video_path and os.path.exists(video_path):
|
| 584 |
output_video = video_path
|
| 585 |
output_file = video_path
|
| 586 |
+
status_msg = gr.update(value=f"✅ Video generado exitosamente. Descarga disponible en {video_path}")
|
| 587 |
+
logger.info(f"Retornando video_path: {video_path}")
|
| 588 |
else:
|
| 589 |
status_msg = gr.update(value="❌ Error: Falló la generación del video.")
|
| 590 |
+
logger.error("No se generó video_path válido.")
|
| 591 |
except ValueError as ve:
|
| 592 |
logger.warning(f"Error de validación: {str(ve)}")
|
| 593 |
status_msg = gr.update(value=f"⚠️ Error: {str(ve)}")
|
| 594 |
except Exception as e:
|
| 595 |
logger.critical(f"Error crítico: {str(e)}")
|
| 596 |
status_msg = gr.update(value=f"❌ Error inesperado: {str(e)}")
|
| 597 |
+
finally:
|
| 598 |
+
logger.info("Finalizando run_app_async")
|
| 599 |
+
return output_video, gr.File(value=output_file, label="Descargar Video"), status_msg
|
| 600 |
|
| 601 |
def run_app(prompt_type, prompt_ia, prompt_manual, musica_file, selected_voice):
|
| 602 |
return asyncio.run(run_app_async(prompt_type, prompt_ia, prompt_manual, musica_file, selected_voice))
|