Linhz commited on
Commit
50d9e8f
·
verified ·
1 Parent(s): 3d5796c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -35,9 +35,9 @@ def question_answering(question):
35
  print(question)
36
  query_sentence = [question]
37
  query_embedding = st.session_state.model_embedding.encode(query_sentence)
38
- k = 500
39
  D, I = index_loaded.search(query_embedding.astype('float32'), k) # D is distances, I is indices
40
- answer = [question_answerer(question=query_sentence[0], context=articles[I[0][i]], max_answer_len = 256) for i in range(k)]
41
  best_answer = max(answer, key=lambda x: x['score'])
42
  print(best_answer['answer'])
43
  if best_answer['score'] > 0.5:
 
35
  print(question)
36
  query_sentence = [question]
37
  query_embedding = st.session_state.model_embedding.encode(query_sentence)
38
+ k = 100
39
  D, I = index_loaded.search(query_embedding.astype('float32'), k) # D is distances, I is indices
40
+ answer = [question_answerer(question=query_sentence[0], context=articles[I[0][i]], max_answer_len = 512) for i in range(k)]
41
  best_answer = max(answer, key=lambda x: x['score'])
42
  print(best_answer['answer'])
43
  if best_answer['score'] > 0.5: