Shriharsh commited on
Commit
80ebf1d
·
verified ·
1 Parent(s): d331743

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -120,10 +120,10 @@ def answer_question(question):
120
 
121
  # Compute cosine similarity with stored embeddings
122
  cos_scores = util.cos_sim(question_embedding, embeddings)[0]
123
- top_k = min(1, len(corpus)) # Get top 3 paragraphs to improve accuracy
124
  top_indices = np.argsort(-cos_scores)[:top_k]
125
 
126
- # Retrieve context (top 3 paragraphs)
127
  contexts = [corpus[i] for i in top_indices]
128
  context = " ".join(contexts) # Concatenate with space
129
  sources = [sources_list[i] for i in top_indices]
 
120
 
121
  # Compute cosine similarity with stored embeddings
122
  cos_scores = util.cos_sim(question_embedding, embeddings)[0]
123
+ top_k = min(1, len(corpus)) # Get top paragraph to improve accuracy
124
  top_indices = np.argsort(-cos_scores)[:top_k]
125
 
126
+ # Retrieve context (top paragraph)
127
  contexts = [corpus[i] for i in top_indices]
128
  context = " ".join(contexts) # Concatenate with space
129
  sources = [sources_list[i] for i in top_indices]