Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -119,10 +119,9 @@ def predict(filepath):
|
|
119 |
tensor = tensor.type(torch.LongTensor)
|
120 |
transform = torchaudio.transforms.Resample(orig_freq=sample_rate, new_freq=new_sample_rate)
|
121 |
tensor = transform(tensor)
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
#return tensor
|
126 |
return tensor
|
127 |
|
128 |
model = torch.load('export.pkl',map_location=torch.device('cpu'))
|
|
|
119 |
tensor = tensor.type(torch.LongTensor)
|
120 |
transform = torchaudio.transforms.Resample(orig_freq=sample_rate, new_freq=new_sample_rate)
|
121 |
tensor = transform(tensor)
|
122 |
+
tensor = model(tensor.unsqueeze(0))
|
123 |
+
tensor = get_likely_index(tensor)
|
124 |
+
tensor = index_to_label(tensor.squeeze())
|
|
|
125 |
return tensor
|
126 |
|
127 |
model = torch.load('export.pkl',map_location=torch.device('cpu'))
|