awacke1 commited on
Commit
de5c44e
1 Parent(s): 95b2e59

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -229,8 +229,8 @@ def pdf2txt(docs):
229
  if file_extension.lower() in ['py', 'txt', 'html', 'htm', 'xml', 'json']:
230
  text += file.getvalue().decode('utf-8')
231
  elif file_extension.lower() == 'pdf':
232
- from PyPDF2 import PdfFileReader
233
- pdf = PdfFileReader(BytesIO(file.getvalue()))
234
  for page in range(pdf.getNumPages()):
235
  text += pdf.getPage(page).extractText()
236
  except Exception as e:
 
229
  if file_extension.lower() in ['py', 'txt', 'html', 'htm', 'xml', 'json']:
230
  text += file.getvalue().decode('utf-8')
231
  elif file_extension.lower() == 'pdf':
232
+ from PyPDF2 import PdfReader
233
+ pdf = PdfReader(BytesIO(file.getvalue()))
234
  for page in range(pdf.getNumPages()):
235
  text += pdf.getPage(page).extractText()
236
  except Exception as e: