Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,10 @@ summarizer = pipeline("summarization")
|
|
14 |
def extract_text_from_pdf(pdf_file):
|
15 |
text = ""
|
16 |
try:
|
17 |
-
|
|
|
|
|
|
|
18 |
for page_num in range(len(document)):
|
19 |
page = document.load_page(page_num)
|
20 |
text += page.get_text()
|
@@ -104,3 +107,4 @@ interface.launch()
|
|
104 |
|
105 |
|
106 |
|
|
|
|
14 |
def extract_text_from_pdf(pdf_file):
|
15 |
text = ""
|
16 |
try:
|
17 |
+
if isinstance(pdf_file, bytes):
|
18 |
+
document = fitz.open(stream=pdf_file, filetype="pdf")
|
19 |
+
else:
|
20 |
+
document = fitz.open(stream=pdf_file.read(), filetype="pdf")
|
21 |
for page_num in range(len(document)):
|
22 |
page = document.load_page(page_num)
|
23 |
text += page.get_text()
|
|
|
107 |
|
108 |
|
109 |
|
110 |
+
|