Update app.py
Browse files
app.py
CHANGED
@@ -13,9 +13,9 @@ from gradio import gr
|
|
13 |
import gradio as gr
|
14 |
|
15 |
# Now copying my code and adapting it for any PDF
|
16 |
-
def extract_abstract(
|
17 |
-
with open(
|
18 |
-
reader = PyPDF2.PdfReader(
|
19 |
text = reader.pages[0].extract_text()
|
20 |
|
21 |
# in order to extract the exact part on the first page that is useful to me,
|
@@ -33,8 +33,8 @@ def extract_abstract(paper_filename):
|
|
33 |
|
34 |
return ""
|
35 |
|
36 |
-
|
37 |
-
abstract_text = extract_abstract(
|
38 |
print(abstract_text)
|
39 |
|
40 |
from transformers import pipeline
|
|
|
13 |
import gradio as gr
|
14 |
|
15 |
# Now copying my code and adapting it for any PDF
|
16 |
+
def extract_abstract(pdf_file_path):
|
17 |
+
with open(pdf_file_path, 'rb') as pdf_file:
|
18 |
+
reader = PyPDF2.PdfReader(pdf_file)
|
19 |
text = reader.pages[0].extract_text()
|
20 |
|
21 |
# in order to extract the exact part on the first page that is useful to me,
|
|
|
33 |
|
34 |
return ""
|
35 |
|
36 |
+
#to be acessed to any pdf
|
37 |
+
abstract_text = extract_abstract(pdf_file_path)
|
38 |
print(abstract_text)
|
39 |
|
40 |
from transformers import pipeline
|