Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -12,40 +12,21 @@ from transformers import GPT2Tokenizer, GPT2LMHeadModel
|
|
12 |
from keybert import KeyBERT
|
13 |
import subprocess
|
14 |
import sys
|
15 |
-
import importlib.util
|
16 |
-
|
17 |
-
# Configuraci贸n de logging
|
18 |
-
logging.basicConfig(
|
19 |
-
level=logging.DEBUG,
|
20 |
-
format='%(asctime)s - %(levelname)s - %(message)s',
|
21 |
-
handlers=[
|
22 |
-
logging.StreamHandler(),
|
23 |
-
logging.FileHandler('video_generator_full.log', encoding='utf-8')
|
24 |
-
]
|
25 |
-
)
|
26 |
-
logger = logging.getLogger(__name__)
|
27 |
-
logger.info("="*80)
|
28 |
-
logger.info("INICIO DE EJECUCI脫N - GENERADOR DE VIDEOS")
|
29 |
-
logger.info("="*80)
|
30 |
-
|
31 |
-
# Forzar reinstalaci贸n de moviepy e imageio-ffmpeg
|
32 |
-
logger.info("Verificando moviepy e imageio-ffmpeg...")
|
33 |
try:
|
34 |
-
import moviepy
|
35 |
from moviepy.editor import VideoFileClip, concatenate_videoclips, AudioFileClip, CompositeAudioClip, concatenate_audioclips, AudioClip
|
36 |
-
logger
|
|
|
37 |
except ImportError:
|
38 |
-
logger.
|
|
|
39 |
try:
|
40 |
subprocess.check_call([sys.executable, "-m", "pip", "install", "--no-cache-dir", "moviepy>=1.0.3", "imageio-ffmpeg>=0.5.1"])
|
41 |
-
import moviepy
|
42 |
from moviepy.editor import VideoFileClip, concatenate_videoclips, AudioFileClip, CompositeAudioClip, concatenate_audioclips, AudioClip
|
43 |
-
logger.info(
|
44 |
except Exception as e:
|
45 |
logger.critical(f"Fallo al instalar moviepy: {str(e)}")
|
46 |
logger.info("Continuando con placeholder para pruebas...")
|
47 |
moviepy = None # Placeholder para evitar errores
|
48 |
-
|
49 |
import re
|
50 |
import math
|
51 |
import shutil
|
@@ -53,6 +34,19 @@ import json
|
|
53 |
from collections import Counter
|
54 |
import time
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
# Diccionario de voces TTS disponibles organizadas por idioma
|
57 |
VOCES_DISPONIBLES = {
|
58 |
"Espa帽ol (Espa帽a)": {
|
@@ -772,15 +766,6 @@ with gr.Blocks(title="Generador de Videos con IA", theme=gr.themes.Soft()) as ap
|
|
772 |
""")
|
773 |
|
774 |
if __name__ == "__main__":
|
775 |
-
logger.info("Verificando dependencias...")
|
776 |
-
try:
|
777 |
-
from moviepy.editor import ColorClip
|
778 |
-
temp_clip = ColorClip((100,100), color=(255,0,0), duration=0.1)
|
779 |
-
temp_clip.close()
|
780 |
-
logger.info("MoviePy y FFmpeg accesibles.")
|
781 |
-
except Exception as e:
|
782 |
-
logger.critical(f"Fallo en dependencias: {e}")
|
783 |
-
raise
|
784 |
os.environ['GRADIO_SERVER_TIMEOUT'] = '3600'
|
785 |
logger.info("Iniciando aplicaci贸n Gradio...")
|
786 |
try:
|
|
|
12 |
from keybert import KeyBERT
|
13 |
import subprocess
|
14 |
import sys
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
try:
|
|
|
16 |
from moviepy.editor import VideoFileClip, concatenate_videoclips, AudioFileClip, CompositeAudioClip, concatenate_audioclips, AudioClip
|
17 |
+
logger = logging.getLogger(__name__)
|
18 |
+
logger.info("MoviePy importado correctamente")
|
19 |
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 para pruebas...")
|
29 |
moviepy = None # Placeholder para evitar errores
|
|
|
30 |
import re
|
31 |
import math
|
32 |
import shutil
|
|
|
34 |
from collections import Counter
|
35 |
import time
|
36 |
|
37 |
+
# Configuraci贸n de logging
|
38 |
+
logging.basicConfig(
|
39 |
+
level=logging.DEBUG,
|
40 |
+
format='%(asctime)s - %(levelname)s - %(message)s',
|
41 |
+
handlers=[
|
42 |
+
logging.StreamHandler(),
|
43 |
+
logging.FileHandler('video_generator_full.log', encoding='utf-8')
|
44 |
+
]
|
45 |
+
)
|
46 |
+
logger.info("="*80)
|
47 |
+
logger.info("INICIO DE EJECUCI脫N - GENERADOR DE VIDEOS")
|
48 |
+
logger.info("="*80)
|
49 |
+
|
50 |
# Diccionario de voces TTS disponibles organizadas por idioma
|
51 |
VOCES_DISPONIBLES = {
|
52 |
"Espa帽ol (Espa帽a)": {
|
|
|
766 |
""")
|
767 |
|
768 |
if __name__ == "__main__":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
769 |
os.environ['GRADIO_SERVER_TIMEOUT'] = '3600'
|
770 |
logger.info("Iniciando aplicaci贸n Gradio...")
|
771 |
try:
|