Starting on November 18th, the Infinia ML IDP Client Library will become available to customers. The IDP Client Library is a collection of python modules used to integrate with Infinia ML’s Intelligent Document Processing Platform (IDP). The Client Library enables customer engineers to write Python application code (or scripts) in order to interact with the IDP Platform. In this platform blog post, we will walk you through the library.
Requirements:
In order to utilize the Infinia IDP Client Library, you will need the following:
- Python 3.8+
- An IDP Account
- An access key and a secret associated with that account
What's Changing in IDP?
- Currently, clients construct all API calls, polling, and data parsing themselves. With the addition of the IDP Client Library, we have streamlined the process for client developers to automate their code integration with our IDP Platform API endpoints. Specifically written in Python modules, this will significantly reduce the manual effort required for clients to write new integration code and allow them to seamlessly interact with our IDP Platform.
IDP Client Library Walkthrough & Code Snippets
Wondering how to use the library? We’ll do a walkthrough of some Python code to show you how.
First, you’ll need to install the package with pip, Python’s package installer:
$ pip install infiniaml_idp_client
Once the installation has completed, create a new Python file called document-processing.py. In this file, we’ll use our new package to process our documents.
We’ll need to initialize some variables from our environment, namely our access key ID, our access key secret, and project ID:
import os
ACCESS_KEY_ID = os.environ["ACCESS_KEY_ID"]
ACCESS_KEY_SECRET = os.environ["ACCESS_KEY_SECRET"]
PROJECT_ID = int(os.environ["PROJECT_ID"])
With these variables at hand, we can now initialize our access key credentials and job client using classes imported from our installed package:
import os
from infiniaml_idp_client import AccessKeyCredentials, JobClient
ACCESS_KEY_ID = os.environ["ACCESS_KEY_ID"]
ACCESS_KEY_SECRET = os.environ["ACCESS_KEY_SECRET"]
PROJECT_ID = int(os.environ["PROJECT_ID"])
creds = AccessKeyCredentials(ACCESS_KEY_ID, ACCESS_KEY_SECRET)
job_client = JobClient(PROJECT_ID, creds)
import os
from infiniaml_idp_client import AccessKeyCredentials, JobClient
ACCESS_KEY_ID = os.environ["ACCESS_KEY_ID"]
ACCESS_KEY_SECRET = os.environ["ACCESS_KEY_SECRET"]
PROJECT_ID = int(os.environ["PROJECT_ID"])
creds = AccessKeyCredentials(ACCESS_KEY_ID, ACCESS_KEY_SECRET)
job_client = JobClient(PROJECT_ID, creds)
with open("revenue.pdf", "rb") as f:
job = job_client.process({"document": f})
import json
import os
from infiniaml_idp_client import AccessKeyCredentials, JobClient
ACCESS_KEY_ID = os.environ["ACCESS_KEY_ID"]
ACCESS_KEY_SECRET = os.environ["ACCESS_KEY_SECRET"]
PROJECT_ID = int(os.environ["PROJECT_ID"])
creds = AccessKeyCredentials(ACCESS_KEY_ID, ACCESS_KEY_SECRET)
job_client = JobClient(PROJECT_ID, creds)
with open("revenue.pdf", "rb") as f:
job = job_client.process({"document": f})
with open("results.json", "w") as f:
json.dump(job["results"], f)
That concludes the walkthrough. For more code examples and information, please take a look at our official documentation.
We're Here to Help
We hope you enjoy these enhancements to our platform. Be sure to check back here for periodic updates on new features and functionality available in IDP.
If you have questions or would like to inquire about specific configuration requests, please contact your Infinia ML representative or send an email to support@infiniaml.com.