Client

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", "https://app.picsellia.com")

get_resource_url_on_platform

Signature

get_resource_url_on_platform()

Description

Get platform url of this resource.

Examples

    print(foo_dataset.get_resource_url_on_platform())
    >>> "https://app.picsellia.com/organization/62cffb84-b92c-450c-bc37-8c4dd4d0f590"

Returns

Url on Platform for this resource


get_datalake

Signature

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

Signature

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

Signature

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

Signature

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

Signature

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

Signature

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


create_model

Signature

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

Signature

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_model_by_id

Signature

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


list_models

Signature

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


create_project

Signature

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

    foo_dataset = client.get_dataset("foo", "v1")
    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

Signature

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

Signature

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

Signature

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_deployment

Signature

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

Signature

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

Signature

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

Signature

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

Signature

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


list_datasources

Signature

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

Signature

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

Signature

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

Signature

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

Signature

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

Signature

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

Signature

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

Signature

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

Signature

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

Signature

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

Signature

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

Signature

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

Signature

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

Signature

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

Signature

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

Signature

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