unstructured icon indicating copy to clipboard operation
unstructured copied to clipboard

bug/NameError: name 'LayoutElements' is not defined

Open anth0nyhak1m opened this issue 10 months ago • 0 comments

Hello unstructured team,

I ran into a bug where the module: unstructured/partition/utils/ocr_models/paddle_ocr.py

Would return the bug described above.

Here was my fix:

in the document where I call partition_pdf()

I set the namespace like so:

import unstructured.partition.utils.ocr_models.paddle_ocr as paddle_ocr_modue
from unstructure_inference.inference.layoutelement import LayoutElements

paddle_ocr_module.LayoutElements = LayoutElements

I am not sure if this is a sustainable solution, and I am not sure why the module itself is not able to find the definition of LayoutElements itself without me manually setting the namespace.

I made sure to have TYPING dependency, and at some point I even removed the condition, neither of which worked.

Please let me know if I missed something during installation that is causing this.

Thanks!

anth0nyhak1m avatar Feb 19 '25 19:02 anth0nyhak1m