not-lain commited on
Commit
651837d
·
1 Parent(s): c52be9c

switch to empty string

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -25,7 +25,7 @@ def convert_file_to_pdf(filename:str) -> str:
25
  converter.convert(filename.name, output_path)
26
  return output_path
27
 
28
- def convert_file_to_img(image_file:str=None,txt:str=None) -> List[Image.Image] :
29
  """
30
  Convert an image file to PDF format.
31
 
@@ -39,9 +39,9 @@ def convert_file_to_img(image_file:str=None,txt:str=None) -> List[Image.Image] :
39
  the same as the input filename but with a .pdf extension.
40
  """
41
  img_list = []
42
- if txt is not None:
43
  image_file.append(load_img(txt))
44
- if image_file is not None :
45
  output_path = image_file.name.rsplit('.', 1)[0] + '.pdf'
46
  converter.convert(image_file.name, output_path)
47
  doc = fitz.open(output_path)
 
25
  converter.convert(filename.name, output_path)
26
  return output_path
27
 
28
+ def convert_file_to_img(image_file:str="",txt:str="") -> List[Image.Image] :
29
  """
30
  Convert an image file to PDF format.
31
 
 
39
  the same as the input filename but with a .pdf extension.
40
  """
41
  img_list = []
42
+ if txt != "":
43
  image_file.append(load_img(txt))
44
+ if image_file != "" :
45
  output_path = image_file.name.rsplit('.', 1)[0] + '.pdf'
46
  converter.convert(image_file.name, output_path)
47
  doc = fitz.open(output_path)