Upload app.py with huggingface_hub
Browse files
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[
|
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)
|