Spaces:
Runtime error
Runtime error
ivan-savchuk
commited on
Commit
β’
0f933d9
1
Parent(s):
42dd8a2
minor updates
Browse files
app.py
CHANGED
@@ -44,7 +44,7 @@ class DocumentSearch:
|
|
44 |
# get scores by index
|
45 |
dists = [dist for dist in distances[0]]
|
46 |
|
47 |
-
return[{'doc': doc[0], 'url': doc[1], 'score': dist} for doc, dist in zip(res_docs, dists)]
|
48 |
##### OLD VERSION WITH CROSS-ENCODER #####
|
49 |
# get answers by index
|
50 |
#answers = [self.docs[i] for i in indeces[0]]
|
@@ -85,7 +85,7 @@ if __name__ == "__main__":
|
|
85 |
# set start time
|
86 |
stt = time.time()
|
87 |
# retrieve top 5 documents
|
88 |
-
results = surfer.search(query, k=
|
89 |
# set endtime
|
90 |
ent = time.time()
|
91 |
# measure resulting time
|
@@ -98,7 +98,7 @@ if __name__ == "__main__":
|
|
98 |
# answer starts with header
|
99 |
st.subheader(f"Answer {i+1}")
|
100 |
# cropped answer
|
101 |
-
doc = answer["doc"][:
|
102 |
# and url to the full answer
|
103 |
url = answer["url"]
|
104 |
# then we display it
|
|
|
44 |
# get scores by index
|
45 |
dists = [dist for dist in distances[0]]
|
46 |
|
47 |
+
return[{'doc': doc[0], 'url': doc[1], 'score': dist} for doc, dist in zip(res_docs, dists)][:k]
|
48 |
##### OLD VERSION WITH CROSS-ENCODER #####
|
49 |
# get answers by index
|
50 |
#answers = [self.docs[i] for i in indeces[0]]
|
|
|
85 |
# set start time
|
86 |
stt = time.time()
|
87 |
# retrieve top 5 documents
|
88 |
+
results = surfer.search(query, k=10)
|
89 |
# set endtime
|
90 |
ent = time.time()
|
91 |
# measure resulting time
|
|
|
98 |
# answer starts with header
|
99 |
st.subheader(f"Answer {i+1}")
|
100 |
# cropped answer
|
101 |
+
doc = answer["doc"][:250] + "..."
|
102 |
# and url to the full answer
|
103 |
url = answer["url"]
|
104 |
# then we display it
|