Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -7,10 +7,9 @@ def pdf_to_images(pdf_file):
|
|
7 |
|
8 |
doc = fitz.open(pdf_file)
|
9 |
images = []
|
10 |
-
|
11 |
for page_id in range(doc.page_count):
|
12 |
page = doc[page_id]
|
13 |
-
|
14 |
pix = page.get_pixmap()
|
15 |
img_bytes = pix.tobytes("png")
|
16 |
images.append((img_bytes, f"{page_id+1}.png"))
|
@@ -46,7 +45,9 @@ iface = gr.Interface(
|
|
46 |
inputs=gr.File(label="Upload PDF File"),
|
47 |
outputs=gr.File(label="Download ZIP File"),
|
48 |
title="PDF to Images Converter",
|
49 |
-
description="Upload a PDF file and download a ZIP file containing all the pages as images."
|
50 |
)
|
51 |
iface.launch()
|
52 |
|
|
|
|
|
|
7 |
|
8 |
doc = fitz.open(pdf_file)
|
9 |
images = []
|
10 |
+
|
11 |
for page_id in range(doc.page_count):
|
12 |
page = doc[page_id]
|
|
|
13 |
pix = page.get_pixmap()
|
14 |
img_bytes = pix.tobytes("png")
|
15 |
images.append((img_bytes, f"{page_id+1}.png"))
|
|
|
45 |
inputs=gr.File(label="Upload PDF File"),
|
46 |
outputs=gr.File(label="Download ZIP File"),
|
47 |
title="PDF to Images Converter",
|
48 |
+
description="Upload a PDF file and download a ZIP file containing all the pages as images. Host it on huggingface for convenience."
|
49 |
)
|
50 |
iface.launch()
|
51 |
|
52 |
+
# Source code
|
53 |
+
# https://juejin.cn/post/7382480523846467595
|