mirror of
https://github.com/DS4SD/docling.git
synced 2025-08-01 15:02:21 +00:00
fix: Fix code-formula model for new docling-core
Signed-off-by: Christoph Auer <cau@zurich.ibm.com>
This commit is contained in:
parent
f46c3990b0
commit
3486fbe9a9
@ -5,6 +5,7 @@ from typing import Iterable, List, Literal, Optional, Tuple, Union
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
from docling_core.types.doc import (
|
from docling_core.types.doc import (
|
||||||
CodeItem,
|
CodeItem,
|
||||||
|
DocItem,
|
||||||
DocItemLabel,
|
DocItemLabel,
|
||||||
DoclingDocument,
|
DoclingDocument,
|
||||||
NodeItem,
|
NodeItem,
|
||||||
@ -233,9 +234,9 @@ class CodeFormulaModel(BaseItemAndImageEnrichmentModel):
|
|||||||
|
|
||||||
labels: List[str] = []
|
labels: List[str] = []
|
||||||
images: List[Union[Image.Image, np.ndarray]] = []
|
images: List[Union[Image.Image, np.ndarray]] = []
|
||||||
elements: List[Union[TextItem | CodeItem]] = []
|
elements: List[TextItem] = []
|
||||||
for el in element_batch:
|
for el in element_batch:
|
||||||
assert isinstance(el.item, TextItem) or isinstance(el.item, CodeItem)
|
assert isinstance(el.item, TextItem)
|
||||||
elements.append(el.item)
|
elements.append(el.item)
|
||||||
labels.append(el.item.label)
|
labels.append(el.item.label)
|
||||||
images.append(el.image)
|
images.append(el.image)
|
||||||
|
Loading…
Reference in New Issue
Block a user