nouamanetazi HF staff commited on
Commit
25b69c5
·
1 Parent(s): b1b97c4
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -60,10 +60,10 @@ def inference(source_video, transcription):
60
  z = np.expand_dims(V,axis=0)
61
  x, y, z = torch.from_numpy(x).to(device), torch.from_numpy(y).to(device), torch.from_numpy(z).float().to(device)
62
  pred = net(x, y, z).cpu().data.numpy()[0]
63
- pred = np.exp(pred) / np.sum(np.exp(pred)) # softmax
64
  label_to_ix = ['happy', 'sad', 'angry', 'fear', 'disgust', 'surprise']
65
  # result_dict = {label_to_ix[i]: float(pred[i]) for i in range(len(label_to_ix))}
66
- result_dict = {label_to_ix[i]: pred[i]>0 for i in range(len(label_to_ix))}
67
  return result_dict
68
 
69
 
 
60
  z = np.expand_dims(V,axis=0)
61
  x, y, z = torch.from_numpy(x).to(device), torch.from_numpy(y).to(device), torch.from_numpy(z).float().to(device)
62
  pred = net(x, y, z).cpu().data.numpy()[0]
63
+ # pred = np.exp(pred) / np.sum(np.exp(pred)) # softmax
64
  label_to_ix = ['happy', 'sad', 'angry', 'fear', 'disgust', 'surprise']
65
  # result_dict = {label_to_ix[i]: float(pred[i]) for i in range(len(label_to_ix))}
66
+ result_dict = {label_to_ix[i]: float(pred[i])>0 for i in range(len(label_to_ix))}
67
  return result_dict
68
 
69