fix fitz
Browse files
app.py
CHANGED
|
@@ -41,7 +41,8 @@ def convert_file_to_img(image_file:str) -> List[Image.Image] :
|
|
| 41 |
converter.convert(image_file.name, output_path)
|
| 42 |
doc = fitz.open(output_path)
|
| 43 |
for page in doc:
|
| 44 |
-
|
|
|
|
| 45 |
doc.close()
|
| 46 |
return img_list
|
| 47 |
|
|
@@ -59,7 +60,7 @@ file_to_pdf = gr.Interface(
|
|
| 59 |
|
| 60 |
image_to_pdf = gr.Interface(
|
| 61 |
fn=convert_file_to_img,
|
| 62 |
-
inputs=gr.File(label="Upload Image"
|
| 63 |
outputs=gr.Gallery(label="Converted Images"),
|
| 64 |
title="File to Images Converter",
|
| 65 |
description="Convert your images to an image format"
|
|
|
|
| 41 |
converter.convert(image_file.name, output_path)
|
| 42 |
doc = fitz.open(output_path)
|
| 43 |
for page in doc:
|
| 44 |
+
page_bytes = page.get_pixmap().tobytes("png")
|
| 45 |
+
img_list.append(load_img(page_bytes).convert("RGB"))
|
| 46 |
doc.close()
|
| 47 |
return img_list
|
| 48 |
|
|
|
|
| 60 |
|
| 61 |
image_to_pdf = gr.Interface(
|
| 62 |
fn=convert_file_to_img,
|
| 63 |
+
inputs=gr.File(label="Upload Image"),
|
| 64 |
outputs=gr.Gallery(label="Converted Images"),
|
| 65 |
title="File to Images Converter",
|
| 66 |
description="Convert your images to an image format"
|