Spaces:
Running
Running
handle multi-channel audio
Browse files
app.py
CHANGED
@@ -26,8 +26,10 @@ def denoise(model_name, inputs):
|
|
26 |
print(f"Audio shape: {audio.shape}")
|
27 |
print(f"Sample rate: {sr}")
|
28 |
|
29 |
-
if audio.shape[1] > 1:
|
30 |
-
audio = audio.mean(1, keepdim=True)
|
|
|
|
|
31 |
|
32 |
if sr != model.config.sample_rate:
|
33 |
audio = torchaudio.functional.resample(audio, sr, model.config.sample_rate)
|
|
|
26 |
print(f"Audio shape: {audio.shape}")
|
27 |
print(f"Sample rate: {sr}")
|
28 |
|
29 |
+
if audio.shape[-1] > 1:
|
30 |
+
audio = audio.mean(-1, keepdim=True)
|
31 |
+
|
32 |
+
print(f"Audio shape: {audio.shape}")
|
33 |
|
34 |
if sr != model.config.sample_rate:
|
35 |
audio = torchaudio.functional.resample(audio, sr, model.config.sample_rate)
|