Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -14,11 +14,13 @@ from datasets import load_dataset
|
|
14 |
|
15 |
from pdfminer.high_level import extract_pages, extract_text
|
16 |
|
|
|
|
|
17 |
summarization = pipeline ('summarization', model = "pszemraj/long-t5-tglobal-base-16384-book-summary")
|
18 |
|
19 |
def summarize_and_speech(pdf_file):
|
20 |
-
|
21 |
-
pdf_reader = PyPDF2.PdfFileReader(
|
22 |
abstract_text = pdf_reader.pages[0].extract_text()
|
23 |
summary = summarization(abstract_text, max_length=13, min_length=10)[0]['summary_text']
|
24 |
|
|
|
14 |
|
15 |
from pdfminer.high_level import extract_pages, extract_text
|
16 |
|
17 |
+
import io
|
18 |
+
|
19 |
summarization = pipeline ('summarization', model = "pszemraj/long-t5-tglobal-base-16384-book-summary")
|
20 |
|
21 |
def summarize_and_speech(pdf_file):
|
22 |
+
pdf_bytes_io = io.BytesIO(pdf_file)
|
23 |
+
pdf_reader = PyPDF2.PdfFileReader(pdf_bytes_io)
|
24 |
abstract_text = pdf_reader.pages[0].extract_text()
|
25 |
summary = summarization(abstract_text, max_length=13, min_length=10)[0]['summary_text']
|
26 |
|