arithescientist commited on
Commit
31e79df
·
1 Parent(s): a04de99

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -6
app.py CHANGED
@@ -27,12 +27,23 @@ bert_legal_model = Summarizer(custom_model=custom_model, custom_tokenizer=custom
27
 
28
 
29
  def pdf(file):
30
- temp = open(file, 'rb')
31
- PDF_read = PDFFileReader(temp)
32
- first_page = PDF_read.getPage
33
-
 
 
 
 
 
 
 
 
 
 
 
34
 
35
- return first_page
36
  #pageObject.extractText()
37
 
38
 
@@ -41,7 +52,7 @@ def pdf(file):
41
 
42
  iface = gr.Interface(
43
  pdf,
44
- "file", "file"
45
  )
46
 
47
  if __name__ == "__main__":
 
27
 
28
 
29
  def pdf(file):
30
+
31
+ path = os.getcwd()
32
+ folder_name = './'
33
+ path = os.path.join(path, folder_name)
34
+
35
+ list_of_files = []
36
+ for root, dirs, files in os.walk(path):
37
+ for file in files:
38
+ if(file.endswith(".pdf")):
39
+ # print(os.path.join(root,file))
40
+ list_of_files.append(os.path.join(root,file))
41
+
42
+ total_pages = print("\nProcessing {} files...\n".format(len(list_of_files)))
43
+
44
+
45
 
46
+ return total_pages
47
  #pageObject.extractText()
48
 
49
 
 
52
 
53
  iface = gr.Interface(
54
  pdf,
55
+ "file", "text"
56
  )
57
 
58
  if __name__ == "__main__":