abischoff commited on
Commit
30d7363
·
verified ·
1 Parent(s): f5f002e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -37,10 +37,11 @@ def process_file(file):
37
 
38
  # lese die Datei ein
39
  def read_file(file):
 
40
  if ".pdf" in file.name:
41
  # creating a pdf reader object
42
  reader = PyPDF2.PdfReader(file.name)
43
- content = ""
44
  counter = 0
45
  while counter < len(reader.pages):
46
  content += reader.pages[counter].extract_text()
@@ -50,8 +51,7 @@ def read_file(file):
50
  content = f.read()
51
  #with open(file.name, 'rb') as f:
52
  # content = pickle.load(f)
53
- return content
54
- return ""
55
 
56
  def is_valid_file(file_path: str, file_types: list[str]) -> bool:
57
  file_extension = os.path.splitext(file_path)[1]
 
37
 
38
  # lese die Datei ein
39
  def read_file(file):
40
+ content = ""
41
  if ".pdf" in file.name:
42
  # creating a pdf reader object
43
  reader = PyPDF2.PdfReader(file.name)
44
+
45
  counter = 0
46
  while counter < len(reader.pages):
47
  content += reader.pages[counter].extract_text()
 
51
  content = f.read()
52
  #with open(file.name, 'rb') as f:
53
  # content = pickle.load(f)
54
+ return content
 
55
 
56
  def is_valid_file(file_path: str, file_types: list[str]) -> bool:
57
  file_extension = os.path.splitext(file_path)[1]