Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -135,7 +135,7 @@ def retrieve_document(query):
|
|
135 |
# Search for the closest document in FAISS index
|
136 |
_, closest_idx = index.search(query_embedding, 1)
|
137 |
|
138 |
-
metadata =
|
139 |
|
140 |
# Check if a relevant document was found
|
141 |
if closest_idx[0][0] == -1 or str(closest_idx[0][0]) not in metadata:
|
@@ -145,6 +145,8 @@ def retrieve_document(query):
|
|
145 |
# Retrieve the document file path
|
146 |
filename = metadata[str(closest_idx[0][0])]
|
147 |
|
|
|
|
|
148 |
pdf_file = requests.get(API_URL_FILES, filename)
|
149 |
|
150 |
# Read and return the document content
|
|
|
135 |
# Search for the closest document in FAISS index
|
136 |
_, closest_idx = index.search(query_embedding, 1)
|
137 |
|
138 |
+
metadata = metadata_file
|
139 |
|
140 |
# Check if a relevant document was found
|
141 |
if closest_idx[0][0] == -1 or str(closest_idx[0][0]) not in metadata:
|
|
|
145 |
# Retrieve the document file path
|
146 |
filename = metadata[str(closest_idx[0][0])]
|
147 |
|
148 |
+
print(filename)
|
149 |
+
|
150 |
pdf_file = requests.get(API_URL_FILES, filename)
|
151 |
|
152 |
# Read and return the document content
|