mdanish commited on
Commit
535927b
·
verified ·
1 Parent(s): 10e00e5

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -60,7 +60,7 @@ def knn_get_score(knn, k, cat, vec):
60
  kscores = scores[sortinds][:k]
61
  if debug: st.write('kscores.shape', kscores.shape)
62
  # Get actual sorted similiarity scores
63
- ksims = cos_sim_table[:, sortinds][:,:k]
64
  if debug: st.write('ksims.shape', ksims.shape)
65
  # Apply normalization after exponential formula
66
  ksims = softmax(10**ksims)
 
60
  kscores = scores[sortinds][:k]
61
  if debug: st.write('kscores.shape', kscores.shape)
62
  # Get actual sorted similiarity scores
63
+ ksims = cos_sim_table[np.expand_dims(np.arange(sortinds.shape[0]), axis=1), sortinds]
64
  if debug: st.write('ksims.shape', ksims.shape)
65
  # Apply normalization after exponential formula
66
  ksims = softmax(10**ksims)