update empty value for file field
Browse files
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=
|
29 |
"""
|
30 |
Convert an image file to PDF format.
|
31 |
|
@@ -41,7 +41,7 @@ def convert_file_to_img(image_file:str="",txt:str="") -> List[Image.Image] :
|
|
41 |
img_list = []
|
42 |
if txt != "":
|
43 |
img_list.append(load_img(txt,output_type="pil"))
|
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)
|
|
|
25 |
converter.convert(filename.name, output_path)
|
26 |
return output_path
|
27 |
|
28 |
+
def convert_file_to_img(image_file:str=None,txt:str="") -> List[Image.Image] :
|
29 |
"""
|
30 |
Convert an image file to PDF format.
|
31 |
|
|
|
41 |
img_list = []
|
42 |
if txt != "":
|
43 |
img_list.append(load_img(txt,output_type="pil"))
|
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)
|