jhauret commited on
Commit
c277d5c
·
1 Parent(s): f8ceff7

go back to image

Browse files
Files changed (2) hide show
  1. app.py +7 -6
  2. 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
- # Convert the figure to an HTML string
51
- html_code = pio.to_html(fig, full_html=False, config={'displaylogo': False, 'modeBarButtonsToRemove': ['toImage', 'zoomIn', 'zoomOut', 'resetScale']})
 
52
 
53
- return html_code
54
 
55
  # Gradio interface
56
- demo = gr.Interface(fn=plot_stft,
57
- inputs=gr.Audio(type="filepath"),
58
- outputs="html")
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