Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ import matplotlib.pyplot as plt
|
|
6 |
from PIL import Image
|
7 |
import tempfile
|
8 |
import os
|
|
|
9 |
|
10 |
def generate_waveform_video(audio_file, image_file):
|
11 |
try:
|
@@ -42,7 +43,7 @@ def generate_waveform_video(audio_file, image_file):
|
|
42 |
ax.fill_between(x, wave_slice - img_h//4, -wave_slice + img_h//4,
|
43 |
facecolor='red', alpha=0.7)
|
44 |
|
45 |
-
# Convertir figura a numpy array
|
46 |
buf = io.BytesIO()
|
47 |
plt.savefig(buf, format='png', bbox_inches='tight', pad_inches=0)
|
48 |
plt.close(fig)
|
|
|
6 |
from PIL import Image
|
7 |
import tempfile
|
8 |
import os
|
9 |
+
import io # Importar el m贸dulo 'io'
|
10 |
|
11 |
def generate_waveform_video(audio_file, image_file):
|
12 |
try:
|
|
|
43 |
ax.fill_between(x, wave_slice - img_h//4, -wave_slice + img_h//4,
|
44 |
facecolor='red', alpha=0.7)
|
45 |
|
46 |
+
# Convertir figura a numpy array usando io.BytesIO
|
47 |
buf = io.BytesIO()
|
48 |
plt.savefig(buf, format='png', bbox_inches='tight', pad_inches=0)
|
49 |
plt.close(fig)
|