
* Support tableformer model choice Signed-off-by: Christoph Auer <cau@zurich.ibm.com> * Update datamodel structure Signed-off-by: Christoph Auer <cau@zurich.ibm.com> * Update docs Signed-off-by: Christoph Auer <cau@zurich.ibm.com> * Cleanup Signed-off-by: Christoph Auer <cau@zurich.ibm.com> * Add test unit for table options Signed-off-by: Christoph Auer <cau@zurich.ibm.com> * Ensure import backwards-compatibility for PipelineOptions Signed-off-by: Christoph Auer <cau@zurich.ibm.com> * Update README Signed-off-by: Christoph Auer <cau@zurich.ibm.com> * Adjust parameters on custom_convert Signed-off-by: Christoph Auer <60343111+cau-git@users.noreply.github.com> * Update Dockerfile Signed-off-by: Christoph Auer <60343111+cau-git@users.noreply.github.com> --------- Signed-off-by: Christoph Auer <cau@zurich.ibm.com> Signed-off-by: Christoph Auer <60343111+cau-git@users.noreply.github.com>
19 lines
607 B
Python
19 lines
607 B
Python
from pathlib import Path
|
|
from typing import Callable, Iterable, List
|
|
|
|
from docling.datamodel.base_models import Page
|
|
from docling.datamodel.pipeline_options import PipelineOptions
|
|
|
|
|
|
class BaseModelPipeline:
|
|
def __init__(self, artifacts_path: Path, pipeline_options: PipelineOptions):
|
|
self.model_pipe: List[Callable] = []
|
|
self.artifacts_path = artifacts_path
|
|
self.pipeline_options = pipeline_options
|
|
|
|
def apply(self, page_batch: Iterable[Page]) -> Iterable[Page]:
|
|
for model in self.model_pipe:
|
|
page_batch = model(page_batch)
|
|
|
|
yield from page_batch
|