Update app.py
Browse files
app.py
CHANGED
@@ -19,12 +19,10 @@ def classify_audio(audio_file):
|
|
19 |
|
20 |
sr, raw_wav = audio_file
|
21 |
|
22 |
-
print(audio_file, audio_file[1].dtype)
|
23 |
y = raw_wav.astype(np.float32)
|
24 |
y /= np.max(np.abs(y))
|
25 |
|
26 |
|
27 |
-
#raw_wav, _ librosa.load(audio_file, sr=16000)
|
28 |
norm_wav = (y - mean) / (std+0.000001)
|
29 |
|
30 |
mask = torch.ones(1, len(norm_wav))
|
@@ -33,7 +31,7 @@ def classify_audio(audio_file):
|
|
33 |
pred = model(wavs, mask).detach().numpy()
|
34 |
|
35 |
pred = {}
|
36 |
-
for i, audio_pred in enumerate(pred
|
37 |
pred[i] = {}
|
38 |
for att_i, att_val in enumerate(audio_pred):
|
39 |
pred[i][id2label[att_i]] = att_val
|
|
|
19 |
|
20 |
sr, raw_wav = audio_file
|
21 |
|
|
|
22 |
y = raw_wav.astype(np.float32)
|
23 |
y /= np.max(np.abs(y))
|
24 |
|
25 |
|
|
|
26 |
norm_wav = (y - mean) / (std+0.000001)
|
27 |
|
28 |
mask = torch.ones(1, len(norm_wav))
|
|
|
31 |
pred = model(wavs, mask).detach().numpy()
|
32 |
|
33 |
pred = {}
|
34 |
+
for i, audio_pred in enumerate(pred):
|
35 |
pred[i] = {}
|
36 |
for att_i, att_val in enumerate(audio_pred):
|
37 |
pred[i][id2label[att_i]] = att_val
|