Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.
Python ai4sciencedocument-analysisdocxextract-datalayout-analysisocrparserpdfpdf-converterpdf-extractor-llmpdf-extractor-pretrainpdf-extractor-ragpdf-parserpptxpythonxlsx
feat: add support for additional image formats in file upload
myhlolic29327fde643
diff --git a/mineru/cli/common.py b/mineru/cli/common.pyindex 7ec73ce9..b2a3ac35 100644--- a/mineru/cli/common.py+++ b/mineru/cli/common.py@@ -17,7 +17,7 @@ from mineru.backend.vlm.vlm_analyze import doc_analyze as vlm_doc_analyzefrom mineru.backend.vlm.vlm_analyze import aio_doc_analyze as aio_vlm_doc_analyzepdf_suffixes = [".pdf"]-image_suffixes = [".png", ".jpeg", ".jpg"]+image_suffixes = [".png", ".jpeg", ".jpg", ".webp", ".gif"]def read_fn(path):diff --git a/mineru/cli/gradio_app.py b/mineru/cli/gradio_app.pyindex 5c20906b..0bd3204a 100644--- a/mineru/cli/gradio_app.py+++ b/mineru/cli/gradio_app.py@@ -11,7 +11,7 @@ import gradio as grfrom gradio_pdf import PDFfrom loguru import logger-from mineru.cli.common import prepare_env, read_fn, aio_do_parse+from mineru.cli.common import prepare_env, read_fn, aio_do_parse, pdf_suffixes, image_suffixesfrom mineru.utils.hash_utils import str_sha256@@ -121,8 +121,8 @@ latex_delimiters = []header_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'resources', 'header.html')-with open(header_path, 'r') as file:- header = file.read()+with open(header_path, 'r') as header_file:+ header = header_file.read()latin_lang = [@@ -199,7 +199,8 @@ def main():with gr.Row():with gr.Column(variant='panel', scale=5):with gr.Row():- file = gr.File(label='Please upload a PDF or image', file_types=['.pdf', '.png', '.jpeg', '.jpg'])+ suffixes = pdf_suffixes + image_suffixes+ input_file = gr.File(label='Please upload a PDF or image', file_types=suffixes)with gr.Row():max_pages = gr.Slider(1, 20, 10, step=1, label='Max convert pages')with gr.Row():@@ -223,7 +224,7 @@ def main():gr.Examples(examples=[os.path.join(example_root, _) for _ in os.listdir(example_root) if_.endswith('pdf')],- inputs=file+ inputs=input_file)with gr.Column(variant='panel', scale=5):@@ -256,10 +257,10 @@ def main():outputs=[client_options, ocr_options, pipeline_options])- file.change(fn=to_pdf, inputs=file, outputs=pdf_show)- change_bu.click(fn=to_markdown, inputs=[file, max_pages, is_ocr, formula_enable, table_enable, language, backend, url],+ input_file.change(fn=to_pdf, inputs=input_file, outputs=pdf_show)+ change_bu.click(fn=to_markdown, inputs=[input_file, max_pages, is_ocr, formula_enable, table_enable, language, backend, url],outputs=[md, md_text, output_file, pdf_show])- clear_bu.add([file, md, pdf_show, md_text, output_file, is_ocr])+ clear_bu.add([input_file, md, pdf_show, md_text, output_file, is_ocr])demo.launch(server_name='localhost')