Skip to main content

Python SDK for the Unitlab.ai data annotation platform

Project description



PyPI Python Downloads License

Unitlab.ai is an AI-driven data annotation platform that automates the collection of raw data, facilitating collaboration with human annotators to produce highly accurate labels for your machine learning models. With our service, you can optimize work efficiency, improve data quality, and reduce costs.

Unitlab Python SDK

Python SDK and CLI for the Unitlab.ai data annotation platform. Manage projects, upload data, and download datasets programmatically or from the command line.

Installation

pip install --upgrade unitlab

Requires Python 3.10+.

Configuration

Get your API key from unitlab.ai and configure the CLI:

# Set API key
unitlab configure --api-key YOUR_API_KEY

# Set a custom API URL
unitlab configure --api-url https://api.unitlab.ai

# Set both at once
unitlab configure --api-key YOUR_API_KEY --api-url https://api.unitlab.ai

Or set environment variables:

export UNITLAB_API_KEY=YOUR_API_KEY

# Optional: point to a custom API server (e.g. self-hosted)
export UNITLAB_API_URL=https://api.unitlab.ai

Python SDK

from unitlab import UnitlabClient

# Initialize with an explicit key
client = UnitlabClient(api_key="YOUR_API_KEY")

# Or read from UNITLAB_API_KEY env var / config file
client = UnitlabClient()

The client can also be used as a context manager:

with UnitlabClient() as client:
    projects = client.projects()

Projects

# List all projects
projects = client.projects()

# Get project details
project = client.project("PROJECT_ID")

Upload data

client.project_upload_data(
    project_id="PROJECT_ID",
    directory="./images",
)

The upload command accepts mixed directories. File type is detected per file from the supported extensions: images, text, video, audio, medical (.dcm, .nii, .nii.gz, .nrrd), and documents (.pdf).

Additional options for specific file types:

# Video files
client.project_upload_data("PROJECT_ID", "./videos", fps=30.0)

# PDF documents
client.project_upload_data("PROJECT_ID", "./pdfs")

# DICOM, NIfTI, and NRRD medical volumes
client.project_upload_data("PROJECT_ID", "./medical")

Datasets

# List all datasets
datasets = client.datasets()

# Download one annotation split using the release's fixed export format
path = client.dataset_download("DATASET_ID", split_type="train")

# Omit split_type to download all available splits as one bundle
path = client.dataset_download("DATASET_ID")

# Download raw files
folder = client.dataset_download_files("DATASET_ID")

CLI

Projects

# List projects
unitlab project list

# Project details
unitlab project detail PROJECT_ID

# Upload data to a project
unitlab project upload PROJECT_ID --directory ./images

# Upload PDFs or medical volumes with the same command
unitlab project upload PROJECT_ID --directory ./pdfs
unitlab project upload PROJECT_ID --directory ./medical

Datasets

# List datasets
unitlab dataset list

# Download one annotation split using the release's fixed export format
unitlab dataset download DATASET_ID --split-type train

# Download all annotation splits as one bundle
unitlab dataset download DATASET_ID

# Download raw files
unitlab dataset download DATASET_ID --download-type files

Documentation

See the full documentation for detailed guides:

License

MIT

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unitlab-2.5.1.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

unitlab-2.5.1-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file unitlab-2.5.1.tar.gz.

File metadata

  • Download URL: unitlab-2.5.1.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for unitlab-2.5.1.tar.gz
Algorithm Hash digest
SHA256 144952dc17ed00a8664c5fa0c472e0318cfbf507af7f332353a7119dcc15b2c6
MD5 79ecaef03c3c544c018c14ad4809958f
BLAKE2b-256 2d13ac8d2fb54460d7afcad9992a05973843471ddcd2516d9fa30f8867dc0a9d

See more details on using hashes here.

File details

Details for the file unitlab-2.5.1-py3-none-any.whl.

File metadata

  • Download URL: unitlab-2.5.1-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for unitlab-2.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0666fba5d62494c06ecfa1975cbf7fb3129514b3cc66b1f03749399c33218101
MD5 88130833049195a36a858ea2c11db89c
BLAKE2b-256 e99429b28ed7be88baf9f186300387c8da157f0806ce75b2422b9716e128bc6c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page