gnosticdev commited on
Commit
0c0757c
verified
1 Parent(s): 01a849d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -13
app.py CHANGED
@@ -6,7 +6,6 @@ from PIL import Image, ImageDraw
6
  import tempfile
7
  import os
8
  import logging
9
- from tqdm import tqdm
10
 
11
  # Configuraci贸n de logging
12
  logging.basicConfig(
@@ -50,7 +49,7 @@ def generate_video(audio_file, image_file):
50
  points.extend([(x, y_pos), (x, y_neg)])
51
 
52
  if len(points) > 2:
53
- draw.polygon(points, fill=(255, 0, 0, 128))
54
 
55
  return np.array(frame)
56
 
@@ -61,18 +60,15 @@ def generate_video(audio_file, image_file):
61
 
62
  # 6. Guardar video
63
  with tempfile.NamedTemporaryFile(suffix=".mp4", delete=False) as tmpfile:
64
- # Mostrar barra de progreso
65
- with tqdm(total=100, desc="Exportando") as pbar:
66
- video.write_videofile(
67
- tmpfile.name,
68
- codec="libx264",
69
- audio_codec="aac",
70
- fps=24,
71
- logger=None,
72
- progress_callback=lambda gd: pbar.update(gd['percent'] - pbar.n)
73
- )
74
 
75
- # Asegurar que el archivo existe
76
  if not os.path.exists(tmpfile.name):
77
  raise Exception("Error al guardar el video temporal")
78
 
 
6
  import tempfile
7
  import os
8
  import logging
 
9
 
10
  # Configuraci贸n de logging
11
  logging.basicConfig(
 
49
  points.extend([(x, y_pos), (x, y_neg)])
50
 
51
  if len(points) > 2:
52
+ draw.polygon(points, fill=(255, 0, 0, 128)) # Rojo semitransparente
53
 
54
  return np.array(frame)
55
 
 
60
 
61
  # 6. Guardar video
62
  with tempfile.NamedTemporaryFile(suffix=".mp4", delete=False) as tmpfile:
63
+ video.write_videofile(
64
+ tmpfile.name,
65
+ codec="libx264",
66
+ audio_codec="aac",
67
+ fps=24,
68
+ logger=None
69
+ )
 
 
 
70
 
71
+ # Verificar que el archivo existe
72
  if not os.path.exists(tmpfile.name):
73
  raise Exception("Error al guardar el video temporal")
74