Spaces:
Build error
Build error
Fix broken rescoring
Browse files
app.py
CHANGED
@@ -54,9 +54,10 @@ def search(query, top_k: int = 10, rescore_multiplier: int = 4):
|
|
54 |
|
55 |
# 6. Sort the scores and return the top_k
|
56 |
start_time = time.time()
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
60 |
df = pd.DataFrame({"Score": [round(value, 2) for value in top_k_scores], "Title": top_k_titles, "Text": top_k_texts})
|
61 |
sort_time = time.time() - start_time
|
62 |
|
|
|
54 |
|
55 |
# 6. Sort the scores and return the top_k
|
56 |
start_time = time.time()
|
57 |
+
indices = scores.argsort()[:top_k]
|
58 |
+
top_k_indices = binary_ids[indices]
|
59 |
+
top_k_scores = scores[indices]
|
60 |
+
top_k_titles, top_k_texts = zip(*[(title_text_dataset[idx]["title"], title_text_dataset[idx]["text"]) for idx in top_k_indices.tolist()])
|
61 |
df = pd.DataFrame({"Score": [round(value, 2) for value in top_k_scores], "Title": top_k_titles, "Text": top_k_texts})
|
62 |
sort_time = time.time() - start_time
|
63 |
|