Spaces:
Running
Running
osanseviero
commited on
Commit
•
77c988d
1
Parent(s):
741e81c
Upload 2 files
Browse files- app.py +4 -3
- requirements.txt +2 -1
app.py
CHANGED
@@ -43,7 +43,7 @@ In this section, we'll look into the waveforms of multiple audios.
|
|
43 |
with gr.Row():
|
44 |
plots = gr.Plot(label="Results")
|
45 |
with gr.Row():
|
46 |
-
button = gr.Button(
|
47 |
|
48 |
# https://github.com/gradio-app/gradio/issues/5469
|
49 |
@gr.on(inputs=[freq, freq2, amplitude], outputs=[audio, plots])
|
@@ -52,7 +52,8 @@ In this section, we'll look into the waveforms of multiple audios.
|
|
52 |
ts = 1.0/sr # sampling interval
|
53 |
t = np.arange(0, 1, ts) # time vector
|
54 |
data = a * np.sin(2 * np.pi * freq * t) + a * np.sin(2 * np.pi * freq2 * t)
|
55 |
-
|
|
|
56 |
|
57 |
fig, axes = plt.subplots(nrows=2, ncols=1, sharex=False)
|
58 |
ax_waveform = axes[0]
|
@@ -77,7 +78,7 @@ In this section, we'll look into the waveforms of multiple audios.
|
|
77 |
|
78 |
fig.tight_layout()
|
79 |
fig.savefig('foo.png')
|
80 |
-
return
|
81 |
button.click(plot_sine, inputs=[freq, freq2, amplitude], outputs=[audio, plots])
|
82 |
with gr.Tab("Spectrograms and Mel Spectrograms"):
|
83 |
gr.Markdown("""## Waveforms
|
|
|
43 |
with gr.Row():
|
44 |
plots = gr.Plot(label="Results")
|
45 |
with gr.Row():
|
46 |
+
button = gr.Button(value="Create")
|
47 |
|
48 |
# https://github.com/gradio-app/gradio/issues/5469
|
49 |
@gr.on(inputs=[freq, freq2, amplitude], outputs=[audio, plots])
|
|
|
52 |
ts = 1.0/sr # sampling interval
|
53 |
t = np.arange(0, 1, ts) # time vector
|
54 |
data = a * np.sin(2 * np.pi * freq * t) + a * np.sin(2 * np.pi * freq2 * t)
|
55 |
+
audio_path = "test.wav"
|
56 |
+
write(audio_path, sr, data)
|
57 |
|
58 |
fig, axes = plt.subplots(nrows=2, ncols=1, sharex=False)
|
59 |
ax_waveform = axes[0]
|
|
|
78 |
|
79 |
fig.tight_layout()
|
80 |
fig.savefig('foo.png')
|
81 |
+
return audio_path, fig
|
82 |
button.click(plot_sine, inputs=[freq, freq2, amplitude], outputs=[audio, plots])
|
83 |
with gr.Tab("Spectrograms and Mel Spectrograms"):
|
84 |
gr.Markdown("""## Waveforms
|
requirements.txt
CHANGED
@@ -1 +1,2 @@
|
|
1 |
-
scipy
|
|
|
|
1 |
+
scipy
|
2 |
+
matplotlib
|