3loi commited on
Commit
d3aaef0
1 Parent(s): 6bcf126

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -29,14 +29,14 @@ def classify_audio(audio_file):
29
  wavs = torch.tensor(norm_wav).unsqueeze(0)
30
 
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
38
-
39
- return pred
40
 
41
 
42
  def main():
@@ -52,3 +52,4 @@ def main():
52
  if __name__ == '__main__':
53
  main()
54
 
 
 
29
  wavs = torch.tensor(norm_wav).unsqueeze(0)
30
 
31
  pred = model(wavs, mask).detach().numpy()
32
+
33
+ output = ''
34
+ # for i, audio_pred in enumerate(pred):
35
+ # output[i] = {}
36
+ for att_i, att_val in enumerate(pred[0]):
37
+ output += "{}: \t{:0.4f}\n".format(id2label[att_i], att_val)
38
 
39
+ return output
 
 
 
 
 
 
40
 
41
 
42
  def main():
 
52
  if __name__ == '__main__':
53
  main()
54
 
55
+