Kabatubare commited on
Commit
af6f03a
1 Parent(s): f91d349

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -42,7 +42,9 @@ def plot_spectrogram_to_image(waveform, sample_rate, n_fft=400):
42
 
43
  def plot_waveform_to_image(waveform, sample_rate):
44
  plt.figure(figsize=(10, 4))
45
- plt.plot(waveform.detach().numpy()[0], color='blue')
 
 
46
  plt.axis('off')
47
  buf = io.BytesIO()
48
  plt.savefig(buf, format='png', bbox_inches='tight', pad_inches=0)
 
42
 
43
  def plot_waveform_to_image(waveform, sample_rate):
44
  plt.figure(figsize=(10, 4))
45
+ if waveform.dim() == 3:
46
+ waveform = waveform.squeeze(0)
47
+ plt.plot(waveform.detach().numpy()[0], color='black')
48
  plt.axis('off')
49
  buf = io.BytesIO()
50
  plt.savefig(buf, format='png', bbox_inches='tight', pad_inches=0)