AnnoLab SDK

Python SDK to interact with AnnoLab

AnnoLab has a python SDK to improve the experience of performing certain AnnoLab actions. We highly recommend using this SDK for things like uploading files, as it greatly speeds uploads and simplifies the experience.

Pypi link

Installing via pip

pip install annolab

Using the sdk

To get started, ensure you have an annolab account at https://app.annolab.ai/signup and have created an API Key. Instructions for creating an API Key may be found at https://docs.annolab.ai/.

  1. Create an instance of the SDK passing your api_key.

from annolab import Annolab
lab = AnnoLab(api_key='YOUR_API_KEY')

Using the sdk to upload pdf source

For pdf uploads to work, the user associated with your api key must have permissions to edit sources on your project. Permissions can be modified by admins on the appropriate project details page found under https://app.annolab.ai/projects

Obtain the project

project = lab.find_project('My Project')

Upload from a local file system to a specific directory in your project. OCR the pdf using annolab OCR

project.create_pdf_source(
    file='/path/to/file', 
    name='custom_name.pdf', 
    directory='Uploads',
    ocr=True,
    ocrProvider='textract_plus', # textract_plus is the same as "Annolab" OCR
)

Using the sdk to upload pdf source and trigger an AI workflow

For pdf uploads invoking workflows to work, the user associated with your api key must have permissions to edit sources on your project and must have the ability to "run" machine learning models on your project.

Obtain the project

project = lab.find_project('My Project')

Upload from a local file system to a specific directory in your project. Use the OCR provider and suite of ML models specified by a workflow

project.create_pdf_source(
    file='/path/to/file', 
    name='custom_name.pdf', 
    directory='Uploads',
    workflow='aircraft_title', 
)

Last updated