Linhz commited on
Commit
07b333e
·
verified ·
1 Parent(s): e3d1d56

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -28,7 +28,7 @@ def question_answering(question):
28
  print(question)
29
  query_sentence = [question]
30
  query_embedding = st.session_state.model_embedding.encode(query_sentence)
31
- k = 20
32
  D, I = index_loaded.search(query_embedding.astype('float32'), k) # D is distances, I is indices
33
  answer = [question_answerer(question=query_sentence[0], context=articles[I[0][i]], max_answer_len = 256) for i in range(k)]
34
  best_answer = max(answer, key=lambda x: x['score'])
 
28
  print(question)
29
  query_sentence = [question]
30
  query_embedding = st.session_state.model_embedding.encode(query_sentence)
31
+ k = 10
32
  D, I = index_loaded.search(query_embedding.astype('float32'), k) # D is distances, I is indices
33
  answer = [question_answerer(question=query_sentence[0], context=articles[I[0][i]], max_answer_len = 256) for i in range(k)]
34
  best_answer = max(answer, key=lambda x: x['score'])