Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -72,16 +72,18 @@ def search():
|
|
72 |
# Sort results by the cross-encoder scores
|
73 |
for idx in range(len(cross_scores)):
|
74 |
hits[idx]['cross-score'] = cross_scores[idx]
|
75 |
-
|
|
|
|
|
76 |
# Output of top-3 hits from re-ranker
|
77 |
print("\n-------------------------\n")
|
78 |
print("Top-3 Cross-Encoder Re-ranker hits")
|
79 |
-
|
80 |
-
for hit in hits[
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
|
86 |
|
87 |
# search button
|
|
|
72 |
# Sort results by the cross-encoder scores
|
73 |
for idx in range(len(cross_scores)):
|
74 |
hits[idx]['cross-score'] = cross_scores[idx]
|
75 |
+
|
76 |
+
hits = sorted(hits, key=lambda x: x['cross-score'], reverse=True)
|
77 |
+
st.session_state.results = hits[:3]
|
78 |
# Output of top-3 hits from re-ranker
|
79 |
print("\n-------------------------\n")
|
80 |
print("Top-3 Cross-Encoder Re-ranker hits")
|
81 |
+
st.subheader("Top-3 Search results")
|
82 |
+
for hit in hits[:3]:
|
83 |
+
st.markdown("score: " + round(hit['cross-score'], 3),
|
84 |
+
st.markdown("title: " + dataset["title"][hit['corpus_id']]),
|
85 |
+
st.markdown("substract: " + dataset["text"][hit['corpus_id']].replace("\n", " ")),
|
86 |
+
st.markdown("link: " + dataset["url"][hit['corpus_id']])
|
87 |
|
88 |
|
89 |
# search button
|