ivan-savchuk commited on
Commit
42dd8a2
β€’
1 Parent(s): 050c0a6

Update without Cross-encoder model

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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
- docs = [self.labels[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(docs, dists)]
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]]