bhulston commited on
Commit
d6bf0f6
1 Parent(s): c1e65f1

Update reranker.py

Browse files
Files changed (1) hide show
  1. reranker.py +1 -2
reranker.py CHANGED
@@ -10,9 +10,8 @@ def reranker(query, matches):
10
  pairs.append([query, match["metadata"]["text"]])
11
 
12
  model = CrossEncoder('cross-encoder/ms-marco-TinyBERT-L-2-v2', max_length = 512)
13
- print("Pairs variable:", pairs)
14
 
15
  scores = model.predict(pairs)
16
- top_indices = np.argsort(scores)[::-5]
17
  top_results = ["Class: " + matches[index]["metadata"]["text"] for index in top_indices]
18
  return top_results
 
10
  pairs.append([query, match["metadata"]["text"]])
11
 
12
  model = CrossEncoder('cross-encoder/ms-marco-TinyBERT-L-2-v2', max_length = 512)
 
13
 
14
  scores = model.predict(pairs)
15
+ top_indices = np.argsort(scores)[::-4]
16
  top_results = ["Class: " + matches[index]["metadata"]["text"] for index in top_indices]
17
  return top_results