Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import asyncio
|
| 3 |
import logging
|
|
@@ -14,7 +17,7 @@ import subprocess
|
|
| 14 |
import re
|
| 15 |
import math
|
| 16 |
from pydub import AudioSegment
|
| 17 |
-
from
|
| 18 |
|
| 19 |
# Configuraci贸n de logging
|
| 20 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
|
@@ -334,22 +337,25 @@ with gr.Blocks() as app:
|
|
| 334 |
)
|
| 335 |
|
| 336 |
with gr.Column(visible=True) as ia_guion_column:
|
| 337 |
-
|
| 338 |
label="Tema para IA",
|
| 339 |
-
lines=2
|
|
|
|
| 340 |
)
|
| 341 |
|
| 342 |
with gr.Column(visible=False) as manual_guion_column:
|
| 343 |
prompt_manual = gr.Textbox(
|
| 344 |
label="Tu Guion",
|
| 345 |
-
lines=5
|
|
|
|
| 346 |
)
|
| 347 |
|
| 348 |
musica_input = gr.Textbox(
|
| 349 |
label="URL M煤sica (opcional)",
|
|
|
|
| 350 |
)
|
| 351 |
|
| 352 |
-
boton = gr.Button("Generar Video")
|
| 353 |
|
| 354 |
with gr.Column():
|
| 355 |
salida_video = gr.Video(label="Video Resultado", interactive=False)
|
|
@@ -363,7 +369,7 @@ with gr.Blocks() as app:
|
|
| 363 |
)
|
| 364 |
|
| 365 |
boton.click(
|
| 366 |
-
fn=lambda: (None, "Procesando..."),
|
| 367 |
outputs=[salida_video, estado_mensaje],
|
| 368 |
queue=False
|
| 369 |
).then(
|
|
@@ -372,5 +378,13 @@ with gr.Blocks() as app:
|
|
| 372 |
outputs=[salida_video, estado_mensaje]
|
| 373 |
)
|
| 374 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 375 |
if __name__ == "__main__":
|
| 376 |
app.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 1 |
+
El error se debe a que el paquete `pexels-api` se instala como `pexels_api` (con gui贸n bajo), pero lo est谩s importando como `pexelsapi` (sin gui贸n). Aqu铆 est谩 la versi贸n corregida con todos los imports y nombres corregidos:
|
| 2 |
+
|
| 3 |
+
```python
|
| 4 |
import os
|
| 5 |
import asyncio
|
| 6 |
import logging
|
|
|
|
| 17 |
import re
|
| 18 |
import math
|
| 19 |
from pydub import AudioSegment
|
| 20 |
+
from pexels_api.pexels import Pexels # Nombre corregido
|
| 21 |
|
| 22 |
# Configuraci贸n de logging
|
| 23 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
|
|
|
| 337 |
)
|
| 338 |
|
| 339 |
with gr.Column(visible=True) as ia_guion_column:
|
| 340 |
+
prompt_ia = gr.Textbox(
|
| 341 |
label="Tema para IA",
|
| 342 |
+
lines=2,
|
| 343 |
+
placeholder="Ej: La belleza de la naturaleza"
|
| 344 |
)
|
| 345 |
|
| 346 |
with gr.Column(visible=False) as manual_guion_column:
|
| 347 |
prompt_manual = gr.Textbox(
|
| 348 |
label="Tu Guion",
|
| 349 |
+
lines=5,
|
| 350 |
+
placeholder="Ej: Hoy exploraremos los misterios del universo..."
|
| 351 |
)
|
| 352 |
|
| 353 |
musica_input = gr.Textbox(
|
| 354 |
label="URL M煤sica (opcional)",
|
| 355 |
+
placeholder="https://ejemplo.com/musica.mp3"
|
| 356 |
)
|
| 357 |
|
| 358 |
+
boton = gr.Button("Generar Video", variant="primary")
|
| 359 |
|
| 360 |
with gr.Column():
|
| 361 |
salida_video = gr.Video(label="Video Resultado", interactive=False)
|
|
|
|
| 369 |
)
|
| 370 |
|
| 371 |
boton.click(
|
| 372 |
+
fn=lambda: (None, "Procesando... (esto puede tomar varios minutos)"),
|
| 373 |
outputs=[salida_video, estado_mensaje],
|
| 374 |
queue=False
|
| 375 |
).then(
|
|
|
|
| 378 |
outputs=[salida_video, estado_mensaje]
|
| 379 |
)
|
| 380 |
|
| 381 |
+
gr.Markdown("### Instrucciones:")
|
| 382 |
+
gr.Markdown("""
|
| 383 |
+
1. Selecciona el tipo de entrada (generar guion o usar uno existente)
|
| 384 |
+
2. Ingresa tu texto o tema
|
| 385 |
+
3. Opcional: a帽ade una URL de m煤sica de fondo
|
| 386 |
+
4. Haz clic en 'Generar Video'
|
| 387 |
+
""")
|
| 388 |
+
|
| 389 |
if __name__ == "__main__":
|
| 390 |
app.launch(server_name="0.0.0.0", server_port=7860)
|