Skip to main content

Python client for Kili Technology labeling tool

Project description

Kili Playground: Kili's Python SDK

Python 3.7 Build Status

Technical Documentation

What is Kili?

Kili is a platform that empowers a data-centric approach to Machine Learning through quality training data creation. It provides collaborative data annotation tools and APIs that enable quick iterations between reliable dataset building and model training. More info here.

Annotation tools examples

Named Entities Extraction and Relation PDF classification and bounding-box Object detection (bounding-box)

and many more.

What is Kili Playground?

Kili Playground is the home of the Kili Python SDK. It comes with several recipes that demonstrate its most frequent use cases.


  • Python >= 3.7
  • Create and copy a Kili API key
  • Add the KILI_API_KEY variable in your bash environment (or in the settings of your favorite IDE) by pasting the API key value you copied above:
export KILI_API_KEY='<you api key value here>'


Install the Kili client with pip:

pip install kili


Instantiate the Kili client:

from kili.client import Kili
kili = Kili()
# You can now use the Kili client!

Note that you can also pass the API key as an argument of the Kili initialization:

kili = Kili(api_key='MY API KEY')

Here is a sample of the operations you can do with the Kili client:

Creating an annotation project

json_interface = {
    "jobs": {
            "mlTask": "CLASSIFICATION",
            "content": {
                "categories": {
                    "RED": {"name": "Red"},
                    "BLACK": {"name": "Black"},
                    "WHITE": {"name": "White"},
                    "GREY": {"name": "Grey"}},
                "input": "radio"
            "instruction": "Color"
project = kili.create_project(
        title="Color classification",
        description="Project ",

Importing data to annotate

assets = [
        "externalId": "example 1",
        "content": "",
        "externalId": "example 2",
        "content": "",
        "externalId": "example 3",
        "content": "./recipes/img/man_on_a_bike.jpeg",

external_id_array = [a.get("externalId") for a in assets]
content_array = [a.get("content") for a in assets]


See the detailled example in this notebook.

Importing predictions

prediction_examples = [
        "external_id": "example 1",
        "json_response": {
            "CLASSIFICATION_JOB": {
                "categories": [{"name": "GREY", "confidence": 46}]
        "external_id": "example 2",
        "json_response": {
            "CLASSIFICATION_JOB": {
                "categories": [{"name": "WHITE", "confidence": 89}]

        external_id_array=[p["external_id"] for p in prediction_examples],
        model_name_array=["My SOTA model"] * len(prediction_examples),
        json_response_array=[p["json_response"] for p in prediction_examples])

See detailled examples in this notebook.

Exporting labels

assets = kili.assets(project_id=project_id)

with open("labels.json", "w") as label_file:
    for asset in assets:
        for label in asset.labels:

See a detailled example in this notebook.

More examples

You can find all several recipes in this folder. Among them:

For more details, read the technical documentation.

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

kili-2.111.1.tar.gz (51.9 kB view hashes)

Uploaded source

Built Distribution

kili-2.111.1-py3-none-any.whl (78.1 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page