Spaces:
Sleeping
Sleeping
Tushar Malik
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -412,7 +412,7 @@ def create_vector_db_and_annoy_index(pdf_path, vector_db_path, annoy_index_path)
|
|
| 412 |
# Cell 9: Run the store embeddings function (example)
|
| 413 |
# Replace 'example.pdf' with your PDF file path.
|
| 414 |
# It will create 'vector_db.pkl' and 'vector_index.ann'
|
| 415 |
-
create_vector_db_and_annoy_index(pdf_path, 'vector_db.pkl', 'vector_index.ann')
|
| 416 |
|
| 417 |
# # Cell 10: Query the chatbot with user input
|
| 418 |
# async def query_chatbot():
|
|
@@ -506,7 +506,9 @@ def chatbot_interface(user_query, response_style, selected_retrieval_methods, se
|
|
| 506 |
annoy_index_path = "vector_index.ann"
|
| 507 |
if pdf_file is not None:
|
| 508 |
pdf_path = pdf_file.name # Get the path of the uploaded file
|
|
|
|
| 509 |
store_embeddings_in_vector_db(pdf_path, 'vector_db.pkl', 'vector_index.ann', chunk_size, overlap)
|
|
|
|
| 510 |
else:
|
| 511 |
return "Please upload a PDF file."
|
| 512 |
|
|
|
|
| 412 |
# Cell 9: Run the store embeddings function (example)
|
| 413 |
# Replace 'example.pdf' with your PDF file path.
|
| 414 |
# It will create 'vector_db.pkl' and 'vector_index.ann'
|
| 415 |
+
#create_vector_db_and_annoy_index(pdf_path, 'vector_db.pkl', 'vector_index.ann')
|
| 416 |
|
| 417 |
# # Cell 10: Query the chatbot with user input
|
| 418 |
# async def query_chatbot():
|
|
|
|
| 506 |
annoy_index_path = "vector_index.ann"
|
| 507 |
if pdf_file is not None:
|
| 508 |
pdf_path = pdf_file.name # Get the path of the uploaded file
|
| 509 |
+
create_vector_db_and_annoy_index(pdf_path, 'vector_db.pkl', 'vector_index.ann')
|
| 510 |
store_embeddings_in_vector_db(pdf_path, 'vector_db.pkl', 'vector_index.ann', chunk_size, overlap)
|
| 511 |
+
|
| 512 |
else:
|
| 513 |
return "Please upload a PDF file."
|
| 514 |
|