Spaces:
Build error
Build error
go back to image
Browse files- app.py +7 -6
- requirements.txt +2 -0
app.py
CHANGED
|
@@ -47,14 +47,15 @@ def plot_stft(audio_file):
|
|
| 47 |
fig.update_xaxes(visible=True, showgrid=False)
|
| 48 |
fig.update_yaxes(visible=True, showgrid=False)
|
| 49 |
|
| 50 |
-
#
|
| 51 |
-
|
|
|
|
| 52 |
|
| 53 |
-
return
|
| 54 |
|
| 55 |
# Gradio interface
|
| 56 |
-
demo = gr.Interface(fn=plot_stft,
|
| 57 |
-
inputs=gr.Audio(type="filepath"),
|
| 58 |
-
outputs="
|
| 59 |
|
| 60 |
demo.launch()
|
|
|
|
| 47 |
fig.update_xaxes(visible=True, showgrid=False)
|
| 48 |
fig.update_yaxes(visible=True, showgrid=False)
|
| 49 |
|
| 50 |
+
# Save the figure as an image
|
| 51 |
+
image_path = 'stft_plot.png'
|
| 52 |
+
fig.write_image(image_path)
|
| 53 |
|
| 54 |
+
return image_path
|
| 55 |
|
| 56 |
# Gradio interface
|
| 57 |
+
demo = gr.Interface(fn=plot_stft,
|
| 58 |
+
inputs=gr.Audio(type="filepath"),
|
| 59 |
+
outputs="image")
|
| 60 |
|
| 61 |
demo.launch()
|
requirements.txt
CHANGED
|
@@ -3,4 +3,6 @@ numpy
|
|
| 3 |
plotly
|
| 4 |
scipy
|
| 5 |
librosa
|
|
|
|
|
|
|
| 6 |
|
|
|
|
| 3 |
plotly
|
| 4 |
scipy
|
| 5 |
librosa
|
| 6 |
+
kaleido
|
| 7 |
+
|
| 8 |
|