fix: Fixes tables when using OCR (#1261)

Fix for the tables when using OCR

Signed-off-by: Maksym Lysak <mly@zurich.ibm.com>
Co-authored-by: Maksym Lysak <mly@zurich.ibm.com>
This commit is contained in:
Maxim Lysak 2025-03-29 10:06:00 +01:00 committed by GitHub
parent 124f921077
commit 7afad7e52d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -229,6 +229,9 @@ class TableStructureModel(BasePageModel):
cell_unit=TextCellUnit.WORD,
bbox=table_cluster.bbox,
)
if len(tcells) == 0:
# In case word-level cells yield empty
tcells = table_cluster.cells
else:
# Otherwise - we use normal (line/phrase) cells
tcells = table_cluster.cells