Skip to content

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

update paddleocr to 2.8+ and add layout score output

赵小蒙a5ff8acea732
diff --git a/magic_pdf/model/doc_analyze_by_pp_structurev2.py b/magic_pdf/model/doc_analyze_by_pp_structurev2.py
index 7a893ccc..ba2dbc90 100644
--- a/magic_pdf/model/doc_analyze_by_pp_structurev2.py
+++ b/magic_pdf/model/doc_analyze_by_pp_structurev2.py
@@ -90,7 +90,10 @@ def doc_analyze(pdf_bytes: bytes, ocr: bool = False, show_log: bool = False):
line['category_id'] = 2
else:
logger.warning(f"unknown type: {line['type']}")
- line['score'] = 0.5 + random.random() * 0.5
+
+ # 兼容不输出score的paddleocr版本
+ if line.get("score") is None:
+ line['score'] = 0.5 + random.random() * 0.5
res = line.pop('res', None)
if res is not None and len(res) > 0:
diff --git a/requirements.txt b/requirements.txt
index 0873005a..514e4526 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -16,4 +16,4 @@ nltk==3.8.1
s3pathlib>=2.1.1
pytest
paddlepaddle
-paddleocr>=2.6.0.3
\ No newline at end of file
+paddleocr @ https://github.com/myhloli/PaddleOCR/releases/download/paddleocr-2.8.2-released/paddleocr-2.8.2-py3-none-any.whl
\ No newline at end of file