Spaces:
Paused
Paused
Update app.py
Browse files
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 =
|
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 =
|
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:
|