aadil732 commited on
Commit
1ab72ca
·
verified ·
1 Parent(s): d238b7e

Update api.py

Browse files
Files changed (1) hide show
  1. api.py +3 -3
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 line in document:
80
- line.page_content = line.page_content.replace('\n', ' ')
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(2)
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