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

minor updates

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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=5)
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"][:150] + "..."
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