Skip to content

Commit 6b4361d

Browse files
committed
update README and add example doc
1 parent 57c2af7 commit 6b4361d

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

README.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,18 @@ from unstructured_client.models.errors import SDKError
3434

3535
s = UnstructuredClient(api_key_auth="YOUR_API_KEY")
3636

37-
filename = "sample-docs/layout-parser-paper.pdf"
38-
file = open(filename, "rb")
37+
filename = "sample-docs/layout-parser-paper-fast.pdf"
3938

40-
req = shared.PartitionParameters(
39+
with open(filename, "rb") as f:
4140
# Note that this currently only supports a single file
42-
files=shared.PartitionParametersFiles(
43-
content=file.read(),
44-
files=filename,
45-
),
41+
files=shared.Files(
42+
content=f.read(),
43+
file_name=filename,
44+
)
45+
req = shared.PartitionParameters(
46+
files=files,
47+
strategy="fast",
48+
)
4649
# Other partition params
4750
strategy="fast",
4851
)
@@ -54,10 +57,14 @@ except SDKError as e:
5457
print(e)
5558

5659
# {
57-
# 'type': 'Title',
58-
# 'element_id': '015301d4f56aa4b20ec10ac889d2343f',
59-
# 'metadata': {'filename': 'layout-parser-paper.pdf', 'filetype': 'application/pdf', 'page_number': 1},
60-
# 'text': 'LayoutParser: A Unified Toolkit for Deep Learning Based Document Image Analysis'
60+
# 'type': 'UncategorizedText',
61+
# 'element_id': '5d05cfc3c8e4a52fd1b3b8bd26648010',
62+
# 'metadata': {
63+
# 'filename': 'layout-parser-paper-fast.pdf',
64+
# 'filetype': 'application/pdf',
65+
# 'page_number': 1
66+
# },
67+
# 'text': '1 2 0 2'
6168
# }
6269
```
6370

168 KB
Binary file not shown.

0 commit comments

Comments
 (0)