pvyas96 commited on
Commit
e588742
·
verified ·
1 Parent(s): 3d354e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -6,13 +6,12 @@ from pdf2image import convert_from_path
6
 
7
  def pdf_to_text(pdf_file):
8
  # Open the PDF file
9
- pdf = PyPDF2.PdfFileReader(pdf_file)
10
 
11
  # Extract the text from each page
12
  text = ''
13
- for page in range(pdf.numPages):
14
- page_obj = pdf.getPage(page)
15
- text += page_obj.extractText()
16
 
17
  # If the text is empty, use OCR to extract the text
18
  if not text:
 
6
 
7
  def pdf_to_text(pdf_file):
8
  # Open the PDF file
9
+ pdf = PyPDF2.PdfReader(pdf_file)
10
 
11
  # Extract the text from each page
12
  text = ''
13
+ for page in pdf.pages:
14
+ text += page.extract_text()
 
15
 
16
  # If the text is empty, use OCR to extract the text
17
  if not text: