Spaces:
Sleeping
Sleeping
Update api.py
Browse files
api.py
CHANGED
|
@@ -76,8 +76,8 @@ def uploading_document_to_pinecone(directory):
|
|
| 76 |
document = pdf_loader.load()
|
| 77 |
|
| 78 |
# Replacing newline characters with spaces
|
| 79 |
-
for
|
| 80 |
-
|
| 81 |
|
| 82 |
# Dividing document content into chunks
|
| 83 |
chunked_data = chunk_document(document)
|
|
@@ -95,7 +95,7 @@ def uploading_document_to_pinecone(directory):
|
|
| 95 |
# Uploading the chunked data to Pinecone index
|
| 96 |
pinecone_index.from_documents(chunked_data, embedding, index_name=index_name)
|
| 97 |
print("Document Uploaded to Pinecone")
|
| 98 |
-
time.sleep(
|
| 99 |
prompt = "What is the Title of the document and a small description of the content."
|
| 100 |
description = response_generator(prompt, profession="Student")
|
| 101 |
return description
|
|
|
|
| 76 |
document = pdf_loader.load()
|
| 77 |
|
| 78 |
# Replacing newline characters with spaces
|
| 79 |
+
for chunk in document:
|
| 80 |
+
chunk.page_content = chunk.page_content.replace('\n', ' ')
|
| 81 |
|
| 82 |
# Dividing document content into chunks
|
| 83 |
chunked_data = chunk_document(document)
|
|
|
|
| 95 |
# Uploading the chunked data to Pinecone index
|
| 96 |
pinecone_index.from_documents(chunked_data, embedding, index_name=index_name)
|
| 97 |
print("Document Uploaded to Pinecone")
|
| 98 |
+
time.sleep(3)
|
| 99 |
prompt = "What is the Title of the document and a small description of the content."
|
| 100 |
description = response_generator(prompt, profession="Student")
|
| 101 |
return description
|