From 5acfd8dc6a34713df2fcd3ad497777983c2c6fc3 Mon Sep 17 00:00:00 2001 From: Vik Paruchuri Date: Thu, 23 Oct 2025 12:19:41 -0400 Subject: [PATCH 1/2] Patch image behavior --- chandra/output.py | 6 +++++- chandra/scripts/templates/screenshot.html | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/chandra/output.py b/chandra/output.py index 173dcd8..aa430fe 100644 --- a/chandra/output.py +++ b/chandra/output.py @@ -30,7 +30,11 @@ def extract_images(html: str, chunks: dict, image: Image.Image): if not img: continue bbox = chunk["bbox"] - block_image = image.crop(bbox) + try: + block_image = image.crop(bbox) + except ValueError: + # Happens when bbox coordinates are invalid + continue img_name = get_image_name(html, div_idx) images[img_name] = block_image return images diff --git a/chandra/scripts/templates/screenshot.html b/chandra/scripts/templates/screenshot.html index 642fe94..42dbf60 100644 --- a/chandra/scripts/templates/screenshot.html +++ b/chandra/scripts/templates/screenshot.html @@ -137,6 +137,7 @@ padding: 30px; line-height: 1.6; color: #333; + font-size: 24px; } .markdown-content h1, .markdown-content h2, .markdown-content h3 { From 528b58c16ff578679730045076b29f69d9816b21 Mon Sep 17 00:00:00 2001 From: Vik Paruchuri Date: Thu, 23 Oct 2025 16:55:16 -0400 Subject: [PATCH 2/2] Track errors properly --- chandra/model/__init__.py | 1 + chandra/model/schema.py | 1 + 2 files changed, 2 insertions(+) diff --git a/chandra/model/__init__.py b/chandra/model/__init__.py index 0b4b9e8..b703a18 100644 --- a/chandra/model/__init__.py +++ b/chandra/model/__init__.py @@ -48,6 +48,7 @@ class InferenceManager: page_box=[0, 0, input_item.image.width, input_item.image.height], token_count=result.token_count, images=extract_images(result.raw, chunks, input_item.image), + error=result.error, ) ) return output diff --git a/chandra/model/schema.py b/chandra/model/schema.py index 623a958..b6b75fa 100644 --- a/chandra/model/schema.py +++ b/chandra/model/schema.py @@ -27,3 +27,4 @@ class BatchOutputItem: page_box: List[int] token_count: int images: dict + error: bool