Skip to content

Commit 824b862

Browse files
authored
support Use this model for PaddleOCR-VL (#1807)
We have released PaddleOCR-VL, a SOTA model for document parsing. To ensure users can easily utilize this model, we need to update to support the “Use this model” functionality for PaddleOCR-VL. Could you please review this PR? Thank you for your time!
1 parent da19330 commit 824b862

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

packages/tasks/src/model-libraries-snippets.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,9 @@ export const paddleocr = (model: ModelData): string[] => {
10521052

10531053
if (model.tags.includes("doc_vlm")) {
10541054
return [
1055-
`# pip install paddleocr
1055+
`# 1. See https://www.paddlepaddle.org.cn/en/install to install paddlepaddle
1056+
# 2. pip install paddleocr
1057+
10561058
from paddleocr import DocVLM
10571059
model = DocVLM(model_name="${nameWithoutNamespace(model.id)}")
10581060
output = model.predict(
@@ -1065,11 +1067,27 @@ for res in output:
10651067
];
10661068
}
10671069

1070+
if (model.tags.includes("document-parse")) {
1071+
return [
1072+
`# See https://www.paddleocr.ai/latest/version3.x/pipeline_usage/PaddleOCR-VL.html to installation
1073+
1074+
from paddleocr import PaddleOCRVL
1075+
pipeline = PaddleOCRVL()
1076+
output = pipeline.predict("path/to/document_image.png")
1077+
for res in output:
1078+
res.print()
1079+
res.save_to_json(save_path="output")
1080+
res.save_to_markdown(save_path="output")`,
1081+
];
1082+
}
1083+
10681084
for (const tag of model.tags) {
10691085
if (tag in mapping) {
10701086
const { className } = mapping[tag];
10711087
return [
1072-
`# pip install paddleocr
1088+
`# 1. See https://www.paddlepaddle.org.cn/en/install to install paddlepaddle
1089+
# 2. pip install paddleocr
1090+
10731091
from paddleocr import ${className}
10741092
model = ${className}(model_name="${nameWithoutNamespace(model.id)}")
10751093
output = model.predict(input="path/to/image.png", batch_size=1)

0 commit comments

Comments
 (0)