Skip to content

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

refactor(model): move page total time logging to custom model analysis

myhlolif1e2f0846702
diff --git a/magic_pdf/model/doc_analyze_by_custom_model.py b/magic_pdf/model/doc_analyze_by_custom_model.py
index ee50d6eb..d3784bad 100644
--- a/magic_pdf/model/doc_analyze_by_custom_model.py
+++ b/magic_pdf/model/doc_analyze_by_custom_model.py
@@ -163,7 +163,9 @@ def doc_analyze(pdf_bytes: bytes, ocr: bool = False, show_log: bool = False,
page_width = img_dict["width"]
page_height = img_dict["height"]
if start_page_id <= index <= end_page_id:
+ page_start = time.time()
result = custom_model(img)
+ logger.info(f'-----page_id : {index}, page total time: {round(time.time() - page_start, 2)}-----')
else:
result = []
page_info = {"page_no": index, "height": page_height, "width": page_width}
diff --git a/magic_pdf/model/pdf_extract_kit.py b/magic_pdf/model/pdf_extract_kit.py
index 73aef175..2fbcf0a5 100644
--- a/magic_pdf/model/pdf_extract_kit.py
+++ b/magic_pdf/model/pdf_extract_kit.py
@@ -170,7 +170,6 @@ class CustomPEKModel:
logger.info('DocAnalysis init done!')
def __call__(self, image):
- page_start = time.time()
# layout检测
layout_start = time.time()
@@ -272,6 +271,4 @@ class CustomPEKModel:
)
logger.info(f'table time: {round(time.time() - table_start, 2)}')
- logger.info(f'-----page total time: {round(time.time() - page_start, 2)}-----')
-
return layout_res