Spaces:
Sleeping
Sleeping
handle multi-channel audio
Browse files
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)
|
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(
|
|
|
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(
|