Cloud Document AI API: Service to parse structured information from unstructured or semi-structured documents using state-of-the-art Google AI such as natural language, computer vision, translation, and AutoML.
In order to use this library, you first need to go through the following steps:
- Select or create a Cloud Platform project.
- Enable billing for your project.
- Enable the Cloud Document AI API.
- Setup Authentication.
Install this library in a virtualenv using pip. virtualenv is a tool to create isolated Python environments. The basic problem it addresses is one of dependencies and versions, and indirectly permissions.
With virtualenv, it's possible to install this library without needing system install permissions, and without clashing with the installed system dependencies.
pip install virtualenv
virtualenv <your-env>
source <your-env>/bin/activate
<your-env>/bin/pip install google-cloud-documentaipip install virtualenv
virtualenv <your-env>
<your-env>\Scripts\activate
<your-env>\Scripts\pip.exe install google-cloud-documentai- Read the Client Library Documentation for Cloud Document AI API API to see other available methods on the client.
- Read the Cloud Document AI API Product documentation to learn more about the product and see How-to Guides.
- View this README to see the full list of Cloud APIs that we cover.
Install pyenv for your platform
Install the latest versions of python version 3.6, 3.7, 3.8, and 3.9 via pyenv.
pyenv install 3.9.${3_9_LATEST_PATCH} pyenv install 3.8.${3_8_LATEST_PATCH} pyenv install 3.7.${3_7_LATEST_PATCH} pyenv install 3.6.${3_6_LATEST_PATCH}
For example:
pyenv install 3.9.7 pyenv install 3.8.12 pyenv install 3.7.11 pyenv install 3.6.14
Change directories to the root of this repo
Create a 3.8 Python virtual enviornment via pyenv:
pyenv virtualenv 3.8.${3_8_LATEST_PATCH} docai-venvFor example:
pyenv virtualenv 3.8.12 docai-venvAcitivate the virtual enviornment and use Python versions 2.7, 3.6, 3.7, and 3.9:
pyenv local docai-venv \ 3.9.${3_9_LATEST_PATCH} \ 3.8.${3_8_LATEST_PATCH} \ 3.7.${3_7_LATEST_PATCH} \ 3.6.${3_6_LATEST_PATCH}
For example:
pyenv local docai-venv 3.9.7 3.8.12 3.7.11 3.6.14Install the required library dependencies and test dependencies in the virtual enviornment:
pip install google-cloud-documentai nox
Note
Nox is directory dependent. Nox will only run tests contained in the current directory and subdirectories. To ensure all tests are run, make sure to run Nox from the root of this repo.
Run all tests:
Change directory to the root of the repo
Run Nox:
nox
Run system tests:
nox -s systemRun unit tests:
nox -s unitRun tests for a specific version of Python:
nox -s py-3.8Run documentation tests:
nox -s docs