Hendrik Schroeter commited on
Commit
e46dd10
1 Parent(s): 3db022a

tryy fix enh spec bug

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -8,9 +8,9 @@ import gradio.outputs
8
  import markdown
9
  import matplotlib.pyplot as plt
10
  import numpy as np
11
- from PIL import Image
12
  import torch
13
  from loguru import logger
 
14
  from torch import Tensor
15
  from torchaudio.backend.common import AudioMetaData
16
 
@@ -143,12 +143,11 @@ def demo_fn(speech_upl: str, noise_type: str, snr: int):
143
  logger.info(f"saved audios: {noisy_fn}, {enhanced_fn}")
144
  ax_noisy.clear()
145
  ax_enh.clear()
146
- return (
147
- gradio.make_waveform(noisy_fn, bar_count=200),
148
- spec_im(sample, sr=sr, figure=fig_noisy, ax=ax_noisy),
149
- gradio.make_waveform(enhanced_fn, bar_count=200),
150
- spec_im(enhanced, sr=sr, figure=fig_enh, ax=ax_enh),
151
- )
152
 
153
 
154
  def specshow(
 
8
  import markdown
9
  import matplotlib.pyplot as plt
10
  import numpy as np
 
11
  import torch
12
  from loguru import logger
13
+ from PIL import Image
14
  from torch import Tensor
15
  from torchaudio.backend.common import AudioMetaData
16
 
 
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, enh_wav, enh_im
 
151
 
152
 
153
  def specshow(