Hendrik Schroeter commited on
Commit
21fe9a1
1 Parent(s): 412b520

use waveform video

Browse files
Files changed (1) hide show
  1. app.py +13 -11
app.py CHANGED
@@ -25,9 +25,9 @@ fig_noisy: plt.Figure
25
  fig_enh: plt.Figure
26
  ax_noisy: plt.Axes
27
  ax_enh: plt.Axes
28
- fig_noisy, ax_noisy = plt.subplots(figsize=(15.2, 5))
29
  fig_noisy.set_tight_layout(True)
30
- fig_enh, ax_enh = plt.subplots(figsize=(15.2, 5))
31
  fig_enh.set_tight_layout(True)
32
 
33
  NOISES = {
@@ -143,9 +143,9 @@ def demo_fn(speech_upl: str, noise_type: str, snr: int):
143
  ax_noisy.clear()
144
  ax_enh.clear()
145
  return (
146
- noisy_fn,
147
  spec_figure(sample, sr=sr, figure=fig_noisy, ax=ax_noisy),
148
- enhanced_fn,
149
  spec_figure(enhanced, sr=sr, figure=fig_enh, ax=ax_enh),
150
  )
151
 
@@ -255,26 +255,28 @@ inputs = [
255
  # source="microphone",
256
  # type="numpy",
257
  # ),
258
- gradio.inputs.Audio(
259
  label="Upload audio sample",
260
  source="upload",
261
  type="filepath",
262
  ),
263
- gradio.inputs.Dropdown(
264
  label="Add background noise",
265
  choices=list(NOISES.keys()),
266
- default="None",
267
  ),
268
- gradio.inputs.Dropdown(
269
  label="Noise Level (SNR)",
270
  choices=["-5", "0", "10", "20"],
271
- default="10",
272
  ),
273
  ]
274
  outputs = [
275
- gradio.Audio(type="filepath", label="Noisy audio"),
 
276
  gradio.Plot(label="Noisy spectrogram"),
277
- gradio.Audio(type="filepath", label="Enhanced audio"),
 
278
  gradio.Plot(label="Enhanced spectrogram"),
279
  ]
280
  description = "This demo denoises audio files using DeepFilterNet. Try it with your own voice!"
 
25
  fig_enh: plt.Figure
26
  ax_noisy: plt.Axes
27
  ax_enh: plt.Axes
28
+ fig_noisy, ax_noisy = plt.subplots(figsize=(15.2, 4))
29
  fig_noisy.set_tight_layout(True)
30
+ fig_enh, ax_enh = plt.subplots(figsize=(15.2, 4))
31
  fig_enh.set_tight_layout(True)
32
 
33
  NOISES = {
 
143
  ax_noisy.clear()
144
  ax_enh.clear()
145
  return (
146
+ gradio.make_waveform(noisy_fn, bar_count=200),
147
  spec_figure(sample, sr=sr, figure=fig_noisy, ax=ax_noisy),
148
+ gradio.make_waveform(enhanced_fn, bar_count=200),
149
  spec_figure(enhanced, sr=sr, figure=fig_enh, ax=ax_enh),
150
  )
151
 
 
255
  # source="microphone",
256
  # type="numpy",
257
  # ),
258
+ gradio.Audio(
259
  label="Upload audio sample",
260
  source="upload",
261
  type="filepath",
262
  ),
263
+ gradio.Dropdown(
264
  label="Add background noise",
265
  choices=list(NOISES.keys()),
266
+ value="None",
267
  ),
268
+ gradio.Dropdown(
269
  label="Noise Level (SNR)",
270
  choices=["-5", "0", "10", "20"],
271
+ value="10",
272
  ),
273
  ]
274
  outputs = [
275
+ gradio.Video(type="filepath", label="Noisy audio"),
276
+ # gradio.Audio(type="filepath", label="Noisy audio"),
277
  gradio.Plot(label="Noisy spectrogram"),
278
+ gradio.Video(type="filepath", label="Noisy audio"),
279
+ # gradio.Audio(type="filepath", label="Enhanced audio"),
280
  gradio.Plot(label="Enhanced spectrogram"),
281
  ]
282
  description = "This demo denoises audio files using DeepFilterNet. Try it with your own voice!"