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
Enhance image link replacement to handle only .jpg files while preserving other formats
myhloli0f62f166e6a8
diff --git a/mineru/cli/gradio_app.py b/mineru/cli/gradio_app.pyindex a7341550..a82f1909 100644--- a/mineru/cli/gradio_app.py+++ b/mineru/cli/gradio_app.py@@ -86,10 +86,14 @@ def replace_image_with_base64(markdown_text, image_dir_path):# 替换图片链接def replace(match):relative_path = match.group(1)- full_path = os.path.join(image_dir_path, relative_path)- base64_image = image_to_base64(full_path)- return f''-+ # 只处理以.jpg结尾的图片+ if relative_path.endswith('.jpg'):+ full_path = os.path.join(image_dir_path, relative_path)+ base64_image = image_to_base64(full_path)+ return f''+ else:+ # 其他格式的图片保持原样+ return match.group(0)# 应用替换return re.sub(pattern, replace, markdown_text)