File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
docling_eval/visualisation Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,14 @@ def _get_document_visualization_data(
146146 logging .error (f"{ page_no } not in page_imgs, get default image." )
147147 doc_img_b64 = from_pil_to_base64 (get_missing_pageimg ())
148148
149- doc_page = doc .export_to_html (image_mode = ImageRefMode .EMBEDDED , page_no = page_no )
149+ try :
150+ doc_page = doc .export_to_html (image_mode = ImageRefMode .EMBEDDED , page_no = page_no )
151+ except ValueError as e :
152+ logging .error (
153+ f"Could not export page { page_no } to HTML due to a ValueError: { e } "
154+ )
155+ doc_page_body = f"<p>ERROR: Could not render page HTML due to invalid coordinates. Details: { e } </p>"
156+ return doc_img_b64 , doc_page_body
150157
151158 # Search for the pattern in the HTML string
152159 mtch = pattern .search (doc_page )
You can’t perform that action at this time.
0 commit comments