diff --git a/docling/models/layout_model.py b/docling/models/layout_model.py index d791507d..1879da40 100644 --- a/docling/models/layout_model.py +++ b/docling/models/layout_model.py @@ -122,8 +122,8 @@ class LayoutModel(BasePageModel): left_clusters = [c for c in clusters if c.label not in exclude_labels] right_clusters = [c for c in clusters if c.label in exclude_labels] # Create a deep copy of the original image for both sides - left_image = copy.deepcopy(page.image) - right_image = copy.deepcopy(page.image) + left_image = page.image.copy() + right_image = page.image.copy() # Draw clusters on both images draw_clusters(left_image, left_clusters, scale_x, scale_y) diff --git a/docling/models/page_preprocessing_model.py b/docling/models/page_preprocessing_model.py index ccc43f53..a1d49490 100644 --- a/docling/models/page_preprocessing_model.py +++ b/docling/models/page_preprocessing_model.py @@ -90,7 +90,7 @@ class PagePreprocessingModel(BasePageModel): # DEBUG code: def draw_text_boxes(image, cells, show: bool = False): - draw = ImageDraw.Draw(image) + draw = ImageDraw.Draw(image.copy()) for c in cells: x0, y0, x1, y1 = ( c.to_bounding_box().l,