Skip to content

Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.

fix: support page range

icecraft29c42a1adda6
diff --git a/magic_pdf/model/doc_analyze_by_custom_model.py b/magic_pdf/model/doc_analyze_by_custom_model.py
index 9bca6941..52302692 100644
--- a/magic_pdf/model/doc_analyze_by_custom_model.py
+++ b/magic_pdf/model/doc_analyze_by_custom_model.py
@@ -146,10 +146,11 @@ def doc_analyze(
img_dict = page_data.get_image()
images.append(img_dict['img'])
page_wh_list.append((img_dict['width'], img_dict['height']))
+
if lang is None or lang == 'auto':
- images_with_extra_info = [(images[index], ocr, dataset._lang) for index in range(len(dataset))]
+ images_with_extra_info = [(images[index], ocr, dataset._lang) for index in range(len(images))]
else:
- images_with_extra_info = [(images[index], ocr, lang) for index in range(len(dataset))]
+ images_with_extra_info = [(images[index], ocr, lang) for index in range(len(images))]
if len(images) >= MIN_BATCH_INFERENCE_SIZE:
batch_size = MIN_BATCH_INFERENCE_SIZE