move back to fixing colors (rgba issue needs fix)
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ import io
|
|
7 |
import librosa
|
8 |
import tempfile
|
9 |
|
10 |
-
def extract_waveform_animation(audio_file, window_seconds=5
|
11 |
y, sr = librosa.load(audio_file, sr=None)
|
12 |
duration = librosa.get_duration(y=y, sr=sr)
|
13 |
FPS = 1
|
@@ -19,8 +19,8 @@ def extract_waveform_animation(audio_file, window_seconds=5, waveform_color="blu
|
|
19 |
first_window = y[:window_length]
|
20 |
x_vals = np.linspace(0, duration, num=len(y))
|
21 |
ax.set_axis_off()
|
22 |
-
|
23 |
-
|
24 |
ax.set_facecolor(waveform_color)
|
25 |
fig.set_facecolor(bg_color)
|
26 |
|
@@ -57,9 +57,7 @@ iface = gr.Interface(
|
|
57 |
fn=extract_waveform_animation,
|
58 |
inputs=[
|
59 |
gr.Audio(type="filepath"),
|
60 |
-
gr.Slider(1, 10, value=5, step=1, label="Window Size (seconds)")
|
61 |
-
gr.ColorPicker(value="blue", label="Waveform Color", format="hex"),
|
62 |
-
gr.ColorPicker(value="#00FFFF00", label="Background Color", format="hex")
|
63 |
],
|
64 |
outputs=gr.Image(),
|
65 |
description="Scroll through audio waveform with a moving window."
|
|
|
7 |
import librosa
|
8 |
import tempfile
|
9 |
|
10 |
+
def extract_waveform_animation(audio_file, window_seconds=5):
|
11 |
y, sr = librosa.load(audio_file, sr=None)
|
12 |
duration = librosa.get_duration(y=y, sr=sr)
|
13 |
FPS = 1
|
|
|
19 |
first_window = y[:window_length]
|
20 |
x_vals = np.linspace(0, duration, num=len(y))
|
21 |
ax.set_axis_off()
|
22 |
+
waveform_color ="blue"
|
23 |
+
bg_color ="#00FFFF00"
|
24 |
ax.set_facecolor(waveform_color)
|
25 |
fig.set_facecolor(bg_color)
|
26 |
|
|
|
57 |
fn=extract_waveform_animation,
|
58 |
inputs=[
|
59 |
gr.Audio(type="filepath"),
|
60 |
+
gr.Slider(1, 10, value=5, step=1, label="Window Size (seconds)")
|
|
|
|
|
61 |
],
|
62 |
outputs=gr.Image(),
|
63 |
description="Scroll through audio waveform with a moving window."
|