Danial7 commited on
Commit
0453d50
·
verified ·
1 Parent(s): 6dc350b

Create utils.py

Browse files
Files changed (1) hide show
  1. utils.py +8 -0
utils.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ import pdfplumber
2
+
3
+ def extract_text_from_pdf(file):
4
+ with pdfplumber.open(file) as pdf:
5
+ return "\n".join(
6
+ page.extract_text()
7
+ for page in pdf.pages if page.extract_text()
8
+ )