Spaces:
Sleeping
Sleeping
handle multi-channel audio
Browse files
app.py
CHANGED
@@ -26,6 +26,9 @@ def denoise(model_name, inputs):
|
|
26 |
print(f"Audio shape: {audio.shape}")
|
27 |
print(f"Sample rate: {sr}")
|
28 |
|
|
|
|
|
|
|
29 |
if sr != model.config.sample_rate:
|
30 |
audio = torchaudio.functional.resample(audio, sr, model.config.sample_rate)
|
31 |
|
|
|
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)
|
34 |
|