Commit
·
f340ee6
1
Parent(s):
dc60e72
page_content var
Browse files
app.py
CHANGED
@@ -25,7 +25,7 @@ def summary(self):
|
|
25 |
|
26 |
# PDF summary and query using stuffing
|
27 |
def pdf_changes(pdf_doc):
|
28 |
-
|
29 |
loader = OnlinePDFLoader(pdf_doc.name)
|
30 |
documents = loader.load()
|
31 |
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=100)
|
@@ -34,9 +34,10 @@ def pdf_changes(pdf_doc):
|
|
34 |
# Initialize summary variable
|
35 |
full_summary = ""
|
36 |
|
37 |
-
# Divide the text into smaller chunks, for example,
|
38 |
-
for i in range(0, len(texts),
|
39 |
-
chunk = " ".join([doc.
|
|
|
40 |
|
41 |
|
42 |
# Load the summarization chain with stuffing method
|
|
|
25 |
|
26 |
# PDF summary and query using stuffing
|
27 |
def pdf_changes(pdf_doc):
|
28 |
+
try:
|
29 |
loader = OnlinePDFLoader(pdf_doc.name)
|
30 |
documents = loader.load()
|
31 |
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=100)
|
|
|
34 |
# Initialize summary variable
|
35 |
full_summary = ""
|
36 |
|
37 |
+
# Divide the text into smaller chunks, for example, 2 pages per chunk
|
38 |
+
for i in range(0, len(texts), 2):
|
39 |
+
chunk = " ".join([doc.page_content for doc in texts[i:i+2]]) # Replace '.content' with the correct attribute
|
40 |
+
|
41 |
|
42 |
|
43 |
# Load the summarization chain with stuffing method
|