Client

Picsellia SDK Client shall be used to communicate with Picsellia services.

You need an API Token, available on web platform.

Examples

client = Client(api_token="a0c9f3bbf7e8bc175494fc44bfc6f89aae3eb9d0", host="https://app.picsellia.com")

Properties

  • id Organization UUID connected with this (Client)

  • name Organization name connected with this (Client)


Methods

get_datalake

get_datalake()

Description

Retrieve default datalake of this organization

Examples

datalake = client.get_datalake()

Returns

The Datalake of the client that you are using


list_datalakes

list_datalakes()

Description

Retrieve all datalakes linked to this organization

Examples

datalakes = client.list_datalakes()

Returns

List of Datalake of the client that you are using


create_dataset

create_dataset(
   name: str, description: str = '', private: bool = True
)

Description

Create a Dataset in this organization.

This method allows user to create a dataset into the organization currently connected.
A dataset can then be versioned into DatasetVersion.
User can specify name of the dataset, a description and if the dataset is private or not.

Examples

Create a dataset named datatest with data from datalake and version it

foo_dataset = client.create_dataset('foo_dataset')
foo_dataset_version_1 = foo_dataset.create_version('first')
some_data = client.get_datalake().list_data(limit=10)
foo_dataset_version_1.add_data(some_data)

Arguments

  • name (str) : Name of the dataset. It must be unique in the organization.

  • description (str, optional) : A description of the dataset. Defaults to ''.

  • private (bool, optional) : Specify if the dataset is private. Defaults to True.

Returns

A Dataset that you can manipulate, connected to Picsellia


get_dataset

get_dataset(
   name: str
)

Description

Retrieve a dataset by its name

Examples

foo_dataset = client.get_dataset('datatest')
foo_dataset_version = foo_dataset.get_version('first')

Arguments

  • name (str) : Name of the dataset

Returns

A Dataset that you can use and manipulate


get_dataset_by_id

get_dataset_by_id(
   id: Union[UUID, str]
)

Description

Get a dataset by its id

Examples

dataset = client.get_dataset('918351d2-3e96-4970-bb3b-420f33ded895')

Arguments

  • id (str) : id of the dataset to retrieve

Returns

A Dataset that you can use and manipulate


list_datasets

list_datasets(
   limit: Optional[int] = None, offset: Optional[int] = None,
   order_by: Optional[List[str]] = None
)

Description

Retrieve all dataset of current organization

Examples

datasets = client.list_datasets()

Returns

A list of Dataset object that belongs to your organization


get_dataset_version_by_id

get_dataset_version_by_id(
   id: Union[UUID, str]
)

Description

Get a dataset version by its id

Examples

dataset_version = client.get_dataset_version_by_id('918351d2-3e96-4970-bb3b-420f33ded895')

Arguments

  • id (str or UUID) : id of the dataset version to retrieve

Returns

A DatasetVersion


create_model

create_model(
   name: str, type: Union[str, InferenceType], framework: Union[str,
   Framework] = Framework.TENSORFLOW, private: bool = True,
   description: str = 'Abrandnewmodel!'
)

Description

Create a new model.

Arguments

  • name (str) : Model name to create.

  • type (InferenceType) : Model type can only be one of (classification, detection, segmentation).

  • framework (Framework) : Framework used by this model.

  • private (bool) : A public model can be seen by everyone. Defaults to true.

  • description (str) : Description of this model

Returns

A Model object that you can manipulate


get_model_by_id

get_model_by_id(
   id: Union[UUID, str]
)

Description

Retrieve a model by its id

Examples

model = client.get_model_by_id(UUID("d8fae655-5c34-4a0a-a59a-e49c89f20998"))

Arguments

  • id (str) : id of the model that you are looking for

Returns

A Model object that you can manipulate


get_model

get_model(
   name: str
)

Description

Retrieve a model by its name.

Examples

model = client.get_model("foo_model")

Arguments

  • name (str) : name of the model you are looking for

Returns

A Model object that you can manipulate


get_public_model

get_public_model(
   name: str
)

Description

Retrieve a public model by its name.
It can only retrieve public model.

Examples

model = client.get_public_model("foo_public_model")

Arguments

  • name (str) : name of the public model you are looking for

Returns

A Model object that you can manipulate


list_models

list_models(
   limit: Optional[int] = None, offset: Optional[int] = None,
   order_by: Optional[List[str]] = None
)

Description

List all models stored in this organization

This will return all the models stored
If no project is found, will throw a ResourceNotFoundError

Examples

models = client.list_models()

Returns

A list of all Model that belong to this organization


list_public_models

list_public_models(
   limit: Optional[int] = None, offset: Optional[int] = None,
   order_by: Optional[List[str]] = None, name: Optional[str] = None, type: Union[str,
   InferenceType, None] = None
)

Description

List all public models of Picsellia Hub
This will return all public models of the hub

Arguments

  • limit (int, optional) : Limit number of public models to retrieve.
    Defaults to None, all public models will be retrieved.

  • offset (int, optional) : Offset to begin with when listing public models.
    Defaults to None, starting at 0.

  • order_by (List[str], optional) : Some fields to order models against.
    Defaults to None, models will not be sorted

  • name (str, optional) : A name to filter public models. It will return models with name containing
    this parameter. Defaults to None, models will not be filtered

  • type (str or InferenceType, optional) : A type to filter public models. It will return models with this type.
    Defaults to None, models will not be filtered.

Examples

public_detection_models = client.list_public_models(type=InferenceType.OBJECT_DETECTION)

Returns

A list of all public Model objects


get_model_version_by_id

get_model_version_by_id(
   id: Union[UUID, str]
)

Description

Get a model version by its id

Examples

model_version = client.get_model_version_by_id('918351d2-3e96-4970-bb3b-420f33ded895')

Arguments

  • id (str or UUID) : id of the model version to retrieve

Returns

A ModelVersion


create_project

create_project(
   name: str, description: Optional[str] = None, private: bool = True
)

Description

Create a project with given name and parameters

This project will be registered into used organization.

Examples

my_project = client.create_project("my_project", description="My first project!")

Arguments

  • name (str) : name of the project

  • description (str) : description of the project

  • private (bool) : shall be true if its only visible by the contributor of the project

Returns

A Project that you can manipulate to run experiments, or attach dataset


get_project

get_project(
   project_name: str
)

Description

Get a project from its name

Retrieve a project from its name.
Project must belong to used organization.

Examples

my_project = client.get_project("my_project")

Arguments

  • project_name (str) : name of the project to retrieve

Returns

A Project of your organization, you can manipulate to run experiments, or attach dataset


get_project_by_id

get_project_by_id(
   id: Union[UUID, str]
)

Description

Get a project from its id

Retrieve a project from its id.
Project must belong to used organization.
If no project is found, will throw a ResourceNotFoundError

Examples

my_project = client.get_project("2214aacc-b884-41e1-b70f-420c0cd7eefb")

Arguments

  • id (str) : id of the project to retrieve

Returns

A Project of your organization, you can manipulate to run experiments, or attach dataset


list_projects

list_projects(
   limit: Optional[int] = None, offset: Optional[int] = None,
   order_by: Optional[List[str]] = None
)

Description

List all projects of your organization.

Retrieve all projects of your organization

Examples

projects = client.list_projects()

Returns

A list of Project of your organization


get_experiment_by_id

get_experiment_by_id(
   id: Union[UUID, str]
)

Description

Get an experiment by its id

Examples

experiment = client.get_experiment_by_id('918351d2-3e96-4970-bb3b-420f33ded895')

Arguments

  • id (str or UUID) : id of the experiment to retrieve

Returns

A Experiment


get_deployment

get_deployment(
   name: str
)

Description

Get a Deployment from its name.

Examples

deployment = client.get_deployment(
    name="awesome-deploy"
)

Arguments

  • name (str) : auto-generated name of your deployment.

Returns

A Deployment object connected and authenticated to all the services.


get_deployment_by_id

get_deployment_by_id(
   id: Union[UUID, str]
)

Description

Get a Deployment from its name.

Examples

deployment = client.get_deployment_id(
    id="YOUR DEPLOYMENT ID"
)

Arguments

  • id (str) : deployment id displayed in your deployment settings.

Returns

A Deployment object connected and authenticated to all the services.


list_deployments

list_deployments(
   limit: Optional[int] = None, offset: Optional[int] = None,
   order_by: Optional[List[str]] = None
)

Description

List all Deployment of your organization

Examples

our_deployments = client.list_deployments()

Arguments

  • limit (int, optional) : number max of results to return

  • offset (int, optional) : offset of page for pagination

  • order_by (list[str], optional) : keys on which deployments shall be sorted

Returns

  • of Deployment : all deployments object connected and authenticated to all the services.

create_datasource

create_datasource(
   name: str
)

Description

Create a data source into this organization

Examples

data_source = client.create_datasource()

Returns

A DataSource object that belongs to your organization


get_datasource

get_datasource(
   name: str
)

Description

Retrieve all data source of current organization

Examples

data_sources = client.list_datasources()

Returns

A list of DataSource object that belongs to your organization


get_or_create_datasource

get_or_create_datasource(
   name: str
)

Description

Retrieve a datasource by its name.
If tag datasource not exist, create it and return it.

Examples

tag = self.get_or_create_datasource("new_source")

Arguments

  • name (str) : Datasource name to retrieve or create

Returns

A Tag object


list_datasources

list_datasources(
   limit: Optional[int] = None, offset: Optional[int] = None,
   order_by: Optional[List[str]] = None
)

Description

Retrieve all data source of current organization

Examples

data_sources = client.list_datasources()

Returns

A list of DataSource object that belongs to your organization


create_dataset_tag

create_dataset_tag(
   name: str
)

Description

Create a Dataset Tag, usable only on Dataset objects

Examples

tag = organization.create_dataset_tag("global")

Arguments

  • name (str) : Name of the tag

Returns

A Tag object


create_dataset_version_tag

create_dataset_version_tag(
   name: str
)

Description

Create a Dataset Version Tag, usable only on Dataset Version objects

Examples

tag = organization.create_dataset_version_tag("train")

Arguments

  • name (str) : Name of the tag

Returns

A Tag object


create_model_tag

create_model_tag(
   name: str
)

Description

Create a Model Tag, usable only on Model objects

Examples

tag = organization.create_model_tag("model")

Arguments

  • name (str) : Name of the tag

Returns

A Tag object


create_model_version_tag

create_model_version_tag(
   name: str
)

Description

Create a Model Version Tag, usable only on Model Version objects

Examples

tag = organization.create_model_version_tag("initial")

Arguments

  • name (str) : Name of the tag

Returns

A Tag object


create_deployment_tag

create_deployment_tag(
   name: str
)

Description

Create a Deployment Tag, usable only on Deployment objects

Examples

tag = organization.create_deployment_tag("operation")

Arguments

  • name (str) : Name of the tag

Returns

A Tag object


list_dataset_tags

list_dataset_tags()

Description

List all Dataset tags, usable only on Dataset objects

Examples

tags = organization.list_dataset_tags()

Returns

A list of Tag objects


list_dataset_version_tags

list_dataset_version_tags()

Description

List all Dataset Version tags, usable only on Dataset Version objects

Examples

tags = organization.list_dataset_version_tags()

Returns

A list of Tag objects


list_model_tags

list_model_tags()

Description

List all Model tags, usable only on Model objects

Examples

tags = organization.list_model_tags()

Returns

A list of Tag objects


list_model_version_tags

list_model_version_tags()

Description

List all Model Version tags, usable only on Model Version objects

Examples

tags = organization.list_model_version_tags()

Returns

A list of Tag objects


list_deployment_tags

list_deployment_tags()

Description

List all Deployment tags, usable only on Deployment Version objects

Examples

tags = organization.list_deployment_tags()

Returns

A list of Tag objects


find_dataset_tag

find_dataset_tag(
   name: str
)

Description

Find a Dataset tag, usable only on Dataset objects, from its name

Examples

tag = organization.find_dataset_tag("global")

Returns

A Tag object


find_dataset_version_tag

find_dataset_version_tag(
   name: str
)

Description

Find a Dataset Version tag, usable only on Dataset Version objects, from its name

Examples

tag = organization.find_dataset_version_tag("train")

Returns

A Tag object


find_model_tag

find_model_tag(
   name: str
)

Description

Find a Model tag, usable only on Model objects, from its name

Examples

tag = organization.find_dataset_version_tag("model")

Returns

A Tag object


find_model_version_tag

find_model_version_tag(
   name: str
)

Description

Find a Model Version tag, usable only on Model version objects, from its name

Examples

tag = organization.find_model_version_tag("initial")

Returns

A Tag object


find_deployment_tag

find_deployment_tag(
   name: str
)

Description

Find a Deployment tag, usable only on Deployment objects, from its name

Examples

tag = organization.find_deployment_tag("operation")

Returns

A Tag object


get_job_by_id

get_job_by_id(
   id: Union[UUID, str]
)

Description

Get a Job from its id.

Examples

deployment = client.get_job_by_id(
    id="YOUR JOB ID"
)

Arguments

  • id (str) : deployment id displayed in your deployment settings.

Returns

A Job object .