Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -20,12 +20,12 @@ except ImportError:
|
|
20 |
logger = logging.getLogger(__name__)
|
21 |
logger.info("Intentando instalar moviepy e imageio-ffmpeg...")
|
22 |
try:
|
23 |
-
subprocess.check_call([sys.executable, "-m", "pip", "install", "--no-cache-dir", "moviepy>=1.0.3", "imageio-ffmpeg>=0.5.1"])
|
24 |
from moviepy.editor import VideoFileClip, concatenate_videoclips, AudioFileClip, CompositeAudioClip, concatenate_audioclips, AudioClip
|
25 |
logger.info("MoviePy instalado tras reintento")
|
26 |
except Exception as e:
|
27 |
logger.critical(f"Fallo al instalar moviepy: {str(e)}")
|
28 |
-
logger.info("Continuando con placeholder
|
29 |
moviepy = None
|
30 |
import re
|
31 |
import math
|
@@ -642,7 +642,10 @@ async def run_app_async(prompt_type, prompt_ia, prompt_manual, musica_file, sele
|
|
642 |
if video_path and os.path.exists(video_path):
|
643 |
output_video = video_path
|
644 |
output_file = video_path
|
645 |
-
|
|
|
|
|
|
|
646 |
logger.info(f"Retornando video_path: {video_path}, URL: {download_url}")
|
647 |
return output_video, gr.File(value=output_file, label="Descargar Video"), status_msg
|
648 |
else:
|
@@ -740,7 +743,7 @@ with gr.Blocks(title="Generador de Videos con IA", theme=gr.themes.Soft()) as ap
|
|
740 |
outputs=[video_output, file_output, status_output],
|
741 |
queue=True
|
742 |
).then(
|
743 |
-
fn=lambda video_path, file_output, status_msg: gr.update(visible=file_output
|
744 |
inputs=[video_output, file_output, status_output],
|
745 |
outputs=[file_output]
|
746 |
)
|
@@ -752,7 +755,7 @@ with gr.Blocks(title="Generador de Videos con IA", theme=gr.themes.Soft()) as ap
|
|
752 |
4. Selecciona la voz.
|
753 |
5. Haz clic en "✨ Generar Video".
|
754 |
6. Revisa el estado. Si el video se genera, estará disponible en /tmp (descárgalo pronto, es temporal).
|
755 |
-
7.
|
756 |
""")
|
757 |
|
758 |
if __name__ == "__main__":
|
|
|
20 |
logger = logging.getLogger(__name__)
|
21 |
logger.info("Intentando instalar moviepy e imageio-ffmpeg...")
|
22 |
try:
|
23 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "--no-cache-dir", "--force-reinstall", "moviepy>=1.0.3", "imageio-ffmpeg>=0.5.1"])
|
24 |
from moviepy.editor import VideoFileClip, concatenate_videoclips, AudioFileClip, CompositeAudioClip, concatenate_audioclips, AudioClip
|
25 |
logger.info("MoviePy instalado tras reintento")
|
26 |
except Exception as e:
|
27 |
logger.critical(f"Fallo al instalar moviepy: {str(e)}")
|
28 |
+
logger.info("Continuando con placeholder. Video no se generará, solo archivo vacío.")
|
29 |
moviepy = None
|
30 |
import re
|
31 |
import math
|
|
|
642 |
if video_path and os.path.exists(video_path):
|
643 |
output_video = video_path
|
644 |
output_file = video_path
|
645 |
+
if not moviepy and os.path.getsize(video_path) <= 100:
|
646 |
+
status_msg = gr.update(value=f"⚠️ Video no generado (MoviePy no disponible). Archivo vacío: {download_url} (descárgalo pronto, /tmp es temporal). Revisa video_generator_full.log.")
|
647 |
+
else:
|
648 |
+
status_msg = gr.update(value=f"✅ Video generado exitosamente. Descarga: {download_url} (Nota: Archivos en /tmp son temporales, descárgalo pronto)")
|
649 |
logger.info(f"Retornando video_path: {video_path}, URL: {download_url}")
|
650 |
return output_video, gr.File(value=output_file, label="Descargar Video"), status_msg
|
651 |
else:
|
|
|
743 |
outputs=[video_output, file_output, status_output],
|
744 |
queue=True
|
745 |
).then(
|
746 |
+
fn=lambda video_path, file_output, status_msg: gr.update(visible=bool(file_output)),
|
747 |
inputs=[video_output, file_output, status_output],
|
748 |
outputs=[file_output]
|
749 |
)
|
|
|
755 |
4. Selecciona la voz.
|
756 |
5. Haz clic en "✨ Generar Video".
|
757 |
6. Revisa el estado. Si el video se genera, estará disponible en /tmp (descárgalo pronto, es temporal).
|
758 |
+
7. Si el video es 0 KB, revisa video_generator_full.log (probable fallo de MoviePy).
|
759 |
""")
|
760 |
|
761 |
if __name__ == "__main__":
|