wrice commited on
Commit
bf095ee
1 Parent(s): 1919a07

add app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -29,10 +29,13 @@ def denoise(inputs):
29
  clean_chunk = MODEL(audio_chunk[None]).logits
30
  clean.append(clean_chunk.squeeze(0))
31
 
32
- denoised = torch.concat(clean).flatten()[: audio.shape[-1]].clamp(-1.0, 1.0)
33
- denoised = (denoised * 32767.0).numpy().astype("int16")
34
-
35
- print(f"Denoised shape: {denoised.shape}")
 
 
 
36
 
37
  return MODEL.config.sample_rate, denoised
38
 
 
29
  clean_chunk = MODEL(audio_chunk[None]).logits
30
  clean.append(clean_chunk.squeeze(0))
31
 
32
+ denoised = (
33
+ torch.concat(clean)
34
+ .flatten()
35
+ .unsqueeze(0)[:, : audio.shape[-1]]
36
+ .clamp(-1.0, 1.0)
37
+ .numpy()
38
+ )
39
 
40
  return MODEL.config.sample_rate, denoised
41