wrice commited on
Commit
61559e0
·
1 Parent(s): f8928f4

handle multi-channel audio

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -47,12 +47,12 @@ def denoise(model_name, inputs):
47
  clean_chunk = model(audio_chunk).logits
48
  clean.append(clean_chunk.squeeze(0))
49
 
50
- denoised = torch.concat(clean).flatten()[: audio.shape[-1]].clamp(-1.0, 1.0)
51
  denoised = (denoised * 32767.0).numpy().astype(np.int16)
52
 
53
  print(f"Denoised shape: {denoised.shape}")
54
 
55
- return model.config.sample_rate, denoised.unsqueeze(0)
56
 
57
 
58
  iface = gr.Interface(
 
47
  clean_chunk = model(audio_chunk).logits
48
  clean.append(clean_chunk.squeeze(0))
49
 
50
+ denoised = torch.concat(clean, 1)[:, : audio.shape[-1]].clamp(-1.0, 1.0)
51
  denoised = (denoised * 32767.0).numpy().astype(np.int16)
52
 
53
  print(f"Denoised shape: {denoised.shape}")
54
 
55
+ return model.config.sample_rate, denoised
56
 
57
 
58
  iface = gr.Interface(