shayanSolSameed commited on
Commit
9fb18d3
·
1 Parent(s): 329a527

Update gradio_chatwithpdf.py

Browse files
Files changed (1) hide show
  1. gradio_chatwithpdf.py +4 -2
gradio_chatwithpdf.py CHANGED
@@ -8,8 +8,10 @@ import os
8
  def read_PDF_2(fileobj):
9
  print("readPDF called")
10
  pdf_text = ""
11
-
12
- with pdfplumber.open(fileobj) as pdf:
 
 
13
  for page in pdf.pages:
14
  pdf_text += page.extract_text()
15
 
 
8
  def read_PDF_2(fileobj):
9
  print("readPDF called")
10
  pdf_text = ""
11
+ path = "./" + os.path.basename(fileobj.name)
12
+ shutil.copyfile(fileobj.name, path)
13
+
14
+ with pdfplumber.open(path) as pdf:
15
  for page in pdf.pages:
16
  pdf_text += page.extract_text()
17