-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdefault_async.txt
More file actions
35 lines (28 loc) · 1004 Bytes
/
default_async.txt
File metadata and controls
35 lines (28 loc) · 1004 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#
# Install the Python client library by running:
# pip install mindee
#
from mindee import Client, AsyncPredictResponse, product
# Init a new client
mindee_client = Client(api_key="my-api-key")
# Add the corresponding endpoint (document).
# Set the account_name to "mindee" if you are using OTS.
my_endpoint = mindee_client.create_endpoint(
account_name="my-account",
endpoint_name="my-endpoint",
version="my-version"
)
# Load a file from disk
input_doc = mindee_client.source_from_path("/path/to/the/file.ext")
# Parse the file.
# The endpoint must be specified since it cannot be determined from the class.
result: AsyncPredictResponse = mindee_client.enqueue_and_parse(
product.GeneratedV1,
input_doc,
endpoint=my_endpoint
)
# Print a brief summary of the parsed data
print(result.document)
# # Iterate over all the fields in the document
# for field_name, field_values in result.document.inference.prediction.fields.items():
# print(field_name, "=", field_values)