Skip to main content

Python client for Kili Technology labeling tool

Project description

Kili Python SDK

Python 3.9 pre-commit GitHub release (latest by date)


SDK Reference: https://python-sdk-docs.kili-technology.com/

Kili Documentation: https://docs.kili-technology.com/docs

App: https://cloud.kili-technology.com/label/

Website: https://kili-technology.com/


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 Python SDK?

Kili Python SDK is the Python client for the Kili platform. It allows to query and manipulate the main entities available in Kili, like projects, assets, labels, api keys...

It comes with several tutorials that demonstrate how to use it in the most frequent use cases.

Requirements

  • Python >= 3.9
  • 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='<your api key value here>'

Installation

Install the Kili client with pip:

pip install kili

If you want to contribute, here are the installation steps.

Usage

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='<your api key value here>')

For more details, read the SDK reference or the Kili documentation.

Tutorials

Check out our tutorials! They will guide you through the main features of the Kili client.

You can find several other recipes in this folder.

Examples

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

Creating an annotation project

json_interface = {
    "jobs": {
        "CLASSIFICATION_JOB": {
            "mlTask": "CLASSIFICATION",
            "content": {
                "categories": {
                    "RED": {"name": "Red"},
                    "BLACK": {"name": "Black"},
                    "WHITE": {"name": "White"},
                    "GREY": {"name": "Grey"}},
                "input": "radio"
            },
            "instruction": "Color"
        }
    }
}
project_id = kili.create_project(
    title="Color classification",
    description="Project ",
    input_type="IMAGE",
    json_interface=json_interface
)["id"]

Importing data to annotate

assets = [
    {
        "externalId": "example 1",
        "content": "https://images.caradisiac.com/logos/3/8/6/7/253867/S0-tesla-enregistre-d-importantes-pertes-au-premier-trimestre-175948.jpg",
    },
    {
        "externalId": "example 2",
        "content": "https://img.sportauto.fr/news/2018/11/28/1533574/1920%7C1280%7Cc096243e5460db3e5e70c773.jpg",
    },
    {
        "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]

kili.append_many_to_dataset(
    project_id=project_id,
    content_array=content_array,
    external_id_array=external_id_array,
)

See the detailed example in this tutorial.

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}]
            }
        },
    }
]

kili.create_predictions(
    project_id=project_id,
    external_id_array=[p["external_id"] for p in prediction_examples],
    json_response_array=[p["json_response"] for p in prediction_examples],
    model_name="My SOTA model"
)

See detailed examples in this recipe.

Exporting labels

kili.export_labels("your_project_id", "export.zip", "yolo_v4")

See a detailed example in this tutorial.

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

kili-25.2.10.tar.gz (265.2 kB view details)

Uploaded Source

Built Distribution

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

kili-25.2.10-py3-none-any.whl (374.1 kB view details)

Uploaded Python 3

File details

Details for the file kili-25.2.10.tar.gz.

File metadata

  • Download URL: kili-25.2.10.tar.gz
  • Upload date:
  • Size: 265.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for kili-25.2.10.tar.gz
Algorithm Hash digest
SHA256 d5fa0ec4bbd51e19b556243f44d192b9604eee43e7768aac78d5ade0c00f7eb8
MD5 503be9fe22e61b381c12b3da89afbc89
BLAKE2b-256 0e47ce3adbb4c97abfa1fa10148466a19b2420d22937a1463d775a0ded09139d

See more details on using hashes here.

Provenance

The following attestation bundles were made for kili-25.2.10.tar.gz:

Publisher: release.yml on kili-technology/kili-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kili-25.2.10-py3-none-any.whl.

File metadata

  • Download URL: kili-25.2.10-py3-none-any.whl
  • Upload date:
  • Size: 374.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for kili-25.2.10-py3-none-any.whl
Algorithm Hash digest
SHA256 b6e5abe6954988c018a58c9678d93f279195fc47644db0cc49b4789ef3d5ef49
MD5 4eb4470ffbb0b7bf3d592b1b3bc4eee3
BLAKE2b-256 409ea4e1ac5bf5e2e921cf448832b1e49763b08b953c023d4c47591a4b59dce5

See more details on using hashes here.

Provenance

The following attestation bundles were made for kili-25.2.10-py3-none-any.whl:

Publisher: release.yml on kili-technology/kili-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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