Update custom_interface_app.py
Browse files- custom_interface_app.py +2 -1
custom_interface_app.py
CHANGED
@@ -85,12 +85,13 @@ class ASR(Pretrained):
|
|
85 |
|
86 |
# waveform, sr = librosa.load(file, sr=sr)
|
87 |
waveform, file_sr = torchaudio.load(file)
|
|
|
88 |
# resample if not 16kHz
|
89 |
if file_sr != sr:
|
90 |
waveform = torchaudio.transforms.Resample(file_sr, sr)(waveform)
|
91 |
|
92 |
# limit to 1 min
|
93 |
-
waveform = waveform[:, :60*sr]
|
94 |
|
95 |
waveform = waveform.squeeze()
|
96 |
audio_length = len(waveform) / sr
|
|
|
85 |
|
86 |
# waveform, sr = librosa.load(file, sr=sr)
|
87 |
waveform, file_sr = torchaudio.load(file)
|
88 |
+
waveform = waveform.mean(dim=0, keepdim=True) # convert to mono
|
89 |
# resample if not 16kHz
|
90 |
if file_sr != sr:
|
91 |
waveform = torchaudio.transforms.Resample(file_sr, sr)(waveform)
|
92 |
|
93 |
# limit to 1 min
|
94 |
+
# waveform = waveform[:, :60*sr]
|
95 |
|
96 |
waveform = waveform.squeeze()
|
97 |
audio_length = len(waveform) / sr
|