Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -52,8 +52,8 @@ def answer_query(query):
|
|
| 52 |
return "❌ Please upload and process a PDF first."
|
| 53 |
|
| 54 |
try:
|
| 55 |
-
query_vec = model.encode(
|
| 56 |
-
D, I = stored_index.search(
|
| 57 |
top_chunks = [stored_chunks[i] for i in I[0]]
|
| 58 |
|
| 59 |
context = "\n\n".join(top_chunks)
|
|
|
|
| 52 |
return "❌ Please upload and process a PDF first."
|
| 53 |
|
| 54 |
try:
|
| 55 |
+
query_vec = model.encode(query).reshape(1, -1)
|
| 56 |
+
D, I = stored_index.search(query_vec, k=3)
|
| 57 |
top_chunks = [stored_chunks[i] for i in I[0]]
|
| 58 |
|
| 59 |
context = "\n\n".join(top_chunks)
|