Spaces:
Runtime error
Runtime error
Matthijs Hollemans
commited on
Commit
β’
ab63f3c
1
Parent(s):
be9fddd
limit audio length
Browse files
app.py
CHANGED
@@ -31,6 +31,9 @@ def process_audio(sampling_rate, waveform):
|
|
31 |
if sampling_rate != 16000:
|
32 |
waveform = librosa.resample(waveform, orig_sr=sampling_rate, target_sr=16000)
|
33 |
|
|
|
|
|
|
|
34 |
# make PyTorch tensor
|
35 |
waveform = torch.tensor(waveform)
|
36 |
return waveform
|
|
|
31 |
if sampling_rate != 16000:
|
32 |
waveform = librosa.resample(waveform, orig_sr=sampling_rate, target_sr=16000)
|
33 |
|
34 |
+
# limit to 30 seconds
|
35 |
+
waveform = waveform[:16000*30]
|
36 |
+
|
37 |
# make PyTorch tensor
|
38 |
waveform = torch.tensor(waveform)
|
39 |
return waveform
|