Spaces:
Runtime error
Runtime error
ivan-savchuk
commited on
Commit
β’
42dd8a2
1
Parent(s):
050c0a6
Update without Cross-encoder model
Browse files
app.py
CHANGED
@@ -40,11 +40,11 @@ class DocumentSearch:
|
|
40 |
# perform search via faiss FlatIP index
|
41 |
distances, indeces = self.index.search(query_vector, k*10)
|
42 |
# get docs by index
|
43 |
-
|
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(
|
48 |
##### OLD VERSION WITH CROSS-ENCODER #####
|
49 |
# get answers by index
|
50 |
#answers = [self.docs[i] for i in indeces[0]]
|
|
|
40 |
# perform search via faiss FlatIP index
|
41 |
distances, indeces = self.index.search(query_vector, k*10)
|
42 |
# get docs by index
|
43 |
+
res_docs = [self.docs[i] for i in indeces[0]]
|
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]]
|