roychao19477 commited on
Commit
6e13067
·
1 Parent(s): 7bf14b8

Fix spectrogram issue

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -113,7 +113,8 @@ def enhance(filepath, model_name):
113
  # enhanced
114
  D_clean = librosa.stft(out, n_fft=1024, hop_length=512)
115
  S_clean = librosa.amplitude_to_db(np.abs(D_clean), ref=np.max)
116
- librosa.display.specshow(S_clean, sr=orig_sr, hop_length=512, x_axis="time", y_axis="hz", ax=axs[1], vmax=0)
 
117
  axs[1].set_title("Enhanced Spectrogram")
118
 
119
  plt.tight_layout()
@@ -148,5 +149,6 @@ with gr.Blocks() as demo:
148
  inputs=[input_audio, model_choice],
149
  outputs=[output_audio, plot_output]
150
  )
 
151
 
152
  demo.queue().launch()
 
113
  # enhanced
114
  D_clean = librosa.stft(out, n_fft=1024, hop_length=512)
115
  S_clean = librosa.amplitude_to_db(np.abs(D_clean), ref=np.max)
116
+ #librosa.display.specshow(S_clean, sr=orig_sr, hop_length=512, x_axis="time", y_axis="hz", ax=axs[1], vmax=0)
117
+ librosa.display.specshow(S_clean, sr=16000, hop_length=512, x_axis="time", y_axis="hz", ax=axs[1], vmax=0)
118
  axs[1].set_title("Enhanced Spectrogram")
119
 
120
  plt.tight_layout()
 
149
  inputs=[input_audio, model_choice],
150
  outputs=[output_audio, plot_output]
151
  )
152
+ gr.Markdown("**Note**: The current models are trained on 16kHz audio. Therefore, any input audio not sampled at 16kHz will be automatically resampled before enhancement.")
153
 
154
  demo.queue().launch()