Spaces:
Sleeping
Sleeping
Commit
·
b6809ba
1
Parent(s):
85187b0
Fix: Now converts to 16kHz
Browse files
app.py
CHANGED
@@ -46,6 +46,11 @@ def predict(inp):
|
|
46 |
#How to transform audio from string to tensor
|
47 |
waveform, sample_rate = torchaudio.load(inp)
|
48 |
|
|
|
|
|
|
|
|
|
|
|
49 |
#Run model without changing weights
|
50 |
with torch.no_grad():
|
51 |
waveform = model(waveform)
|
|
|
46 |
#How to transform audio from string to tensor
|
47 |
waveform, sample_rate = torchaudio.load(inp)
|
48 |
|
49 |
+
#Resample to 16kHz
|
50 |
+
transform_to_16hz = torchaudio.transforms.Resample(orig_freq=sample_rate, new_freq=16000)
|
51 |
+
waveform = transform_to_16hz(waveform)
|
52 |
+
sample_rate = 16000
|
53 |
+
|
54 |
#Run model without changing weights
|
55 |
with torch.no_grad():
|
56 |
waveform = model(waveform)
|