Hendrik Schroeter commited on
Commit
d929b06
1 Parent(s): 59a7cff
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -136,18 +136,18 @@ def demo_fn(speech_upl: str, noise_type: str, snr: int):
136
  enhanced = resample(enhanced, sr, meta.sample_rate)
137
  sample = resample(sample, sr, meta.sample_rate)
138
  sr = meta.sample_rate
139
- noisy_fn = tempfile.NamedTemporaryFile(suffix="noisy.wav", delete=False).name
140
  save_audio(noisy_fn, sample, sr)
141
- enhanced_fn = tempfile.NamedTemporaryFile(suffix="enhanced.wav", delete=False).name
142
  save_audio(enhanced_fn, enhanced, sr)
143
  logger.info(f"saved audios: {noisy_fn}, {enhanced_fn}")
144
  ax_noisy.clear()
145
  ax_enh.clear()
146
  noisy_im = spec_im(sample, sr=sr, figure=fig_noisy, ax=ax_noisy)
147
  enh_im = spec_im(enhanced, sr=sr, figure=fig_enh, ax=ax_enh)
148
- noisy_wav = gradio.make_waveform(noisy_fn, bar_count=200)
149
- enh_wav = gradio.make_waveform(enhanced_fn, bar_count=200)
150
- return noisy_im, noisy_wav, enh_im, enh_wav
151
 
152
 
153
  def specshow(
@@ -265,10 +265,12 @@ inputs = [
265
  ),
266
  ]
267
  outputs = [
 
 
268
  gradio.Image(label="Noisy spectrogram"),
269
- gradio.Video(type="filepath", label="Noisy audio"),
 
270
  gradio.Image(label="Enhanced spectrogram"),
271
- gradio.Video(type="filepath", label="Enhanced audio"),
272
  ]
273
  description = "This demo denoises audio files using DeepFilterNet. Try it with your own voice!"
274
  iface = gradio.Interface(
 
136
  enhanced = resample(enhanced, sr, meta.sample_rate)
137
  sample = resample(sample, sr, meta.sample_rate)
138
  sr = meta.sample_rate
139
+ noisy_wav = tempfile.NamedTemporaryFile(suffix="noisy.wav", delete=False).name
140
  save_audio(noisy_fn, sample, sr)
141
+ enhanced_wav = tempfile.NamedTemporaryFile(suffix="enhanced.wav", delete=False).name
142
  save_audio(enhanced_fn, enhanced, sr)
143
  logger.info(f"saved audios: {noisy_fn}, {enhanced_fn}")
144
  ax_noisy.clear()
145
  ax_enh.clear()
146
  noisy_im = spec_im(sample, sr=sr, figure=fig_noisy, ax=ax_noisy)
147
  enh_im = spec_im(enhanced, sr=sr, figure=fig_enh, ax=ax_enh)
148
+ # noisy_wav = gradio.make_waveform(noisy_fn, bar_count=200)
149
+ # enh_wav = gradio.make_waveform(enhanced_fn, bar_count=200)
150
+ return noisy_wav, noisy_im, enhanced_wav, enh_im
151
 
152
 
153
  def specshow(
 
265
  ),
266
  ]
267
  outputs = [
268
+ # gradio.Video(type="filepath", label="Noisy audio"),
269
+ gradio.Audio(type="filepath", label="Noisy audio"),
270
  gradio.Image(label="Noisy spectrogram"),
271
+ # gradio.Video(type="filepath", label="Enhanced audio"),
272
+ gradio.Audio(type="filepath", label="Enhanced audio"),
273
  gradio.Image(label="Enhanced spectrogram"),
 
274
  ]
275
  description = "This demo denoises audio files using DeepFilterNet. Try it with your own voice!"
276
  iface = gradio.Interface(