mirror of
https://github.com/DS4SD/docling.git
synced 2025-08-02 15:32:30 +00:00
fix artifacts_path type
Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>
This commit is contained in:
parent
2c35b57e34
commit
6c3d31d68b
@ -1,6 +1,6 @@
|
|||||||
import re
|
import re
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Iterable, List, Literal, Optional, Tuple
|
from typing import Iterable, List, Literal, Optional, Tuple, Union
|
||||||
|
|
||||||
from docling_core.types.doc import CodeItem, DoclingDocument, NodeItem, TextItem
|
from docling_core.types.doc import CodeItem, DoclingDocument, NodeItem, TextItem
|
||||||
from docling_core.types.doc.base import BoundingBox
|
from docling_core.types.doc.base import BoundingBox
|
||||||
@ -62,7 +62,7 @@ class CodeFormulaModel(BaseItemAndImageEnrichmentModel):
|
|||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
enabled: bool,
|
enabled: bool,
|
||||||
artifacts_path: Optional[Path],
|
artifacts_path: Optional[Union[Path, str]],
|
||||||
options: CodeFormulaModelOptions,
|
options: CodeFormulaModelOptions,
|
||||||
accelerator_options: AcceleratorOptions,
|
accelerator_options: AcceleratorOptions,
|
||||||
):
|
):
|
||||||
@ -92,6 +92,8 @@ class CodeFormulaModel(BaseItemAndImageEnrichmentModel):
|
|||||||
|
|
||||||
if artifacts_path is None:
|
if artifacts_path is None:
|
||||||
artifacts_path = self.download_models_hf()
|
artifacts_path = self.download_models_hf()
|
||||||
|
else:
|
||||||
|
artifacts_path = Path(artifacts_path)
|
||||||
|
|
||||||
self.code_formula_model = CodeFormulaPredictor(
|
self.code_formula_model = CodeFormulaPredictor(
|
||||||
artifacts_path=artifacts_path,
|
artifacts_path=artifacts_path,
|
||||||
|
Loading…
Reference in New Issue
Block a user