Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.0.7

* Fix a hardcoded file extension causing confusion in the logs

## 1.0.6

* Add slicing through indexing for vectorized elements
Expand Down
2 changes: 1 addition & 1 deletion unstructured_inference/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.0.6" # pragma: no cover
__version__ = "1.0.7" # pragma: no cover
11 changes: 7 additions & 4 deletions unstructured_inference/inference/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,15 @@ def process_data_with_model(
password: Optional[str] = None,
**kwargs: Any,
) -> DocumentLayout:
"""Process PDF as file-like object `data` into a `DocumentLayout`.
"""Process PDF or image as file-like object `data` into a `DocumentLayout`.

Uses the model identified by `model_name`.
"""
# Note: We use a temp dir, not a temp file,
# because the latter fails on Windows
# https://github.com/Unstructured-IO/unstructured-inference/pull/376
with tempfile.TemporaryDirectory() as tmp_dir_path:
file_path = os.path.join(tmp_dir_path, "document.pdf")
file_path = os.path.join(tmp_dir_path, "document")
with open(file_path, "wb") as f:
f.write(data.read())
f.flush()
Expand All @@ -365,8 +368,8 @@ def process_file_with_model(
password: Optional[str] = None,
**kwargs: Any,
) -> DocumentLayout:
"""Processes pdf file with name filename into a DocumentLayout by using a model identified by
model_name."""
"""Processes pdf or image file with name filename into a DocumentLayout by using
a model identified by model_name."""

model = get_model(model_name, **kwargs)
if isinstance(model, UnstructuredObjectDetectionModel):
Expand Down