--- id: unstructured-inference version: "1.6.13" license: Apache-2.0 license_treatment: permissive maintenance: active --- # unstructured-inference — A library for performing inference using trained models. License: permissive · Maintenance: active · Downloads: 1.2M/mo ## What it is and what it does unstructured-inference provides hosted model inference for document layout analysis and element extraction. It wraps detection models (Detectron2, YOLOX) and OCR pipelines to identify and extract text regions, tables, and structural elements from PDFs and images. The core workflow detects layout regions on a page, then extracts their contents via direct text extraction, OCR, or table-specific inference. The package is designed as a backend for the broader unstructured ecosystem—it handles the model inference layer while the unstructured package orchestrates partitioning and higher-level document processing. It requires modern Python (3.11–3.13) and a substantial dependency stack including torch, transformers, and onnxruntime, reflecting its reliance on deep-learning models for detection and OCR. Use it for: - Extract structured text and table regions from PDF documents for downstream NLP or data-pipeline processing. - Detect and classify layout elements (headers, paragraphs, tables, images) in scanned or digital documents. - Integrate custom detection models by wrapping them in the UnstructuredObjectDetectionModel interface. - Preprocess documents for machine-learning pipelines that require clean, labeled element boundaries. - Build document-parsing workflows that combine layout detection with OCR for mixed-format inputs. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Runs inference on layout-parsing and document-analysis models to extract structured elements (text, tables, regions) from PDFs, images, and other document formats. Yes, if you need to extract structured elements from documents and can meet the Python version and dependency requirements. The package is actively maintained, has no known vulnerabilities, and offers a clean API for layout-based document analysis. Install only if you accept the large dependency footprint (torch, transformers, onnxruntime) and can handle Detectron2's platform constraints—particularly on Windows, where it lacks official support. ## Install pip install unstructured-inference uv add unstructured-inference poetry add unstructured-inference ## Installing unstructured-inference Before you install: Low friction install with a pure-Python wheel, but requires Python >=3.11, <3.14. Detectron2, needed for layoutparser models, must be installed separately and has platform constraints (not officially supported on Windows). Active maintenance with a recent release. License in practice: Apache-2.0 permissive license allows commercial and private use with minimal restrictions; you must include a copy of the license and note any modifications. Quickstart: pip install unstructured-inference from unstructured_inference.inference.layout import DocumentLayout layout = DocumentLayout.from_file("sample.pdf") print(layout.pages[0].elements) Requires Python >=3.11, <3.14. Detectron2 (for layoutparser models) must be installed separately and is not officially supported on Windows. Verify before relying: - Whether Detectron2 installation difficulty on Windows is a practical blocker for typical use cases. - Performance characteristics and model accuracy on different document types (scanned vs. digital PDFs, various layouts). - Whether the 15 runtime dependencies (torch, transformers, onnxruntime, etc.) are all required or conditionally loaded. ## Package facts - License: Apache-2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 1.2M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags document layout parsing, pdf element detection, ocr and table extraction, unstructured document preprocessing, layout analysis models, document structure inference, page element detection, document-parsing, layout-detection, ocr [View on SkillFed](https://skillfed.io/packages/unstructured-inference) · [View on PyPI](https://pypi.org/project/unstructured-inference/)