fizban99 commited on
Commit
40e2a74
·
1 Parent(s): eaee63c

increase k to 10

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -19,13 +19,14 @@ cross_encoder = CrossEncoder('cross-encoder/ms-marco-MiniLM-L-6-v2')
19
  documentdb = Simiandb("mystore", embedding_function=hf, mode="a")
20
 
21
  def search(query):
22
- hits = documentdb.similarity_search(query)
23
  cross_inp = [[query, hit] for hit in hits]
24
  cross_scores = cross_encoder.predict(cross_inp)
25
  hits = [hit for _, hit in sorted(zip(cross_scores, hits), reverse=True)]
26
- return hits[0]
27
 
28
  iface = gr.Interface(fn=search, inputs="text", outputs="text")
29
  iface.launch()
30
 
31
- #print(search("what is the balloon boy hoax"))
 
 
19
  documentdb = Simiandb("mystore", embedding_function=hf, mode="a")
20
 
21
  def search(query):
22
+ hits = documentdb.similarity_search(query, k=10)
23
  cross_inp = [[query, hit] for hit in hits]
24
  cross_scores = cross_encoder.predict(cross_inp)
25
  hits = [hit for _, hit in sorted(zip(cross_scores, hits), reverse=True)]
26
+ return hits
27
 
28
  iface = gr.Interface(fn=search, inputs="text", outputs="text")
29
  iface.launch()
30
 
31
+ #print(search("what is the balloon boy hoax"))
32
+ # print(search("date of birth of elon musk"))