Spaces:
Runtime error
Runtime error
Commit ·
0c1ec10
1
Parent(s): 5d26f13
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,15 +21,14 @@ def pdf_to_imgs(pdf):
|
|
| 21 |
imgs = pdf2image.convert_from_path(path_to_pdf, last_page=last_page)
|
| 22 |
#num_pages = len(imgs)
|
| 23 |
|
| 24 |
-
#return np.array(imgs[0]), num_pages
|
| 25 |
return np.array(imgs[0])
|
|
|
|
| 26 |
|
| 27 |
-
title = "PDF
|
| 28 |
description = "Drop a PDF (WARNING: only the first page will be converted into an image)."
|
| 29 |
examples =[["exemple.pdf"]]
|
| 30 |
css = ".output-image, .input-image, .image-preview {height: 600px !important}"
|
| 31 |
allow_flagging = "never"
|
| 32 |
-
theme = "peach" # default, huggingface, grass, peach
|
| 33 |
|
| 34 |
iface = gr.Interface(fn=pdf_to_imgs,
|
| 35 |
#inputs=[gr.File(label="PDF"), gr.Checkbox(label="Only first page?", value=True)],
|
|
@@ -43,6 +42,5 @@ iface = gr.Interface(fn=pdf_to_imgs,
|
|
| 43 |
#article=article,
|
| 44 |
css=css,
|
| 45 |
allow_flagging=allow_flagging,
|
| 46 |
-
theme=theme
|
| 47 |
)
|
| 48 |
iface.launch(debug=False, enable_queue=True)
|
|
|
|
| 21 |
imgs = pdf2image.convert_from_path(path_to_pdf, last_page=last_page)
|
| 22 |
#num_pages = len(imgs)
|
| 23 |
|
|
|
|
| 24 |
return np.array(imgs[0])
|
| 25 |
+
#return np.array(imgs[0]), num_pages
|
| 26 |
|
| 27 |
+
title = "First page of a PDF >> image"
|
| 28 |
description = "Drop a PDF (WARNING: only the first page will be converted into an image)."
|
| 29 |
examples =[["exemple.pdf"]]
|
| 30 |
css = ".output-image, .input-image, .image-preview {height: 600px !important}"
|
| 31 |
allow_flagging = "never"
|
|
|
|
| 32 |
|
| 33 |
iface = gr.Interface(fn=pdf_to_imgs,
|
| 34 |
#inputs=[gr.File(label="PDF"), gr.Checkbox(label="Only first page?", value=True)],
|
|
|
|
| 42 |
#article=article,
|
| 43 |
css=css,
|
| 44 |
allow_flagging=allow_flagging,
|
|
|
|
| 45 |
)
|
| 46 |
iface.launch(debug=False, enable_queue=True)
|