<!-- Source: https://docs.squirro.com/en/latest/api/squirro_client.topic.MLPublishMixin.html -->
# MLPublishMixin

**`class MLPublishMixin`**

Bases: [`object`](https://docs.python.org/3.11/library/functions.html#object)

Methods SummaryMethods Documentation

**`get_ml_published_model(project_id, publish_id, include_pipeline_workflows=False)`**

Returns the details of the a published model.

Parameters

- `project_id` – Id of the Squirro project.
- `publish_id` – id of the published model.
- `include_pipeline_workflows` – Flag to include the information about pipeline workflows that are using the published model with the response.

**`get_ml_published_models(project_id, include_pipeline_workflows=False)`**

Returns all the publishing model for a given project.

Parameters

- `project_id` – Id of the Squirro project.
- `include_pipeline_workflows` – Flag to include the information about pipeline workflows that are using the published models with the response.

**`ml_publish_model(project_id, published_as, description, model_id=None, model_name=None, gt_id=None, gt_name=None, gt_version=None, template_id=None, template_name=None, workflow_id=None, workflow_config=None, workflow_name=None, tagging_level=None, labels=None, location=None, global_id=None, orig_project_id=None, external_model=False)`**

Publish new ML Model.

Parameters

- `project_id` – Id of the Squirro project.
- `published_as` – Name of the published model.
- `description` – Text to be shown describing the model.
- `model_id` – Id of the model to be published.
- `model_name` – Name of ais model.
- `gt_id` – Id of the groundtruth used for the model.
- `gt_name` – Name of the groundtruth used for the model.
- `gt_version` – Version of the groundtruth used for the model.
- `template_id` – Id of the template used for the model.
- `template_name` – Name of the template used for the model.
- `workflow_id` – Id of the workflow of the model to be published.
- `workflow_config` – Workflow config of the model to be published.
- `workflow_name` – Workflow name of the model to be published.
- `tagging_level` – Tagging level of the model to be published.
- `labels` – Labels of the model to be published.
- `location` – Location of the model to be published.
- `global_id` – Global_id of the model to be published.
- `orig_project_id` – Id of the project where it was publish originally.
- `external_model` – Flag to determine if the published model is from external.

This function can be used in three cases of publishing a model:

**Case 1: Publish an ais model: saves an ais model in the publish database,**

fetches and save the heritage information (model, gt) while creation.
Use the param ´external_model´=False and the model-id of the
ais model you want to publish.

**Case 2: Publish a model from external directly to the ingestion pipeline by providing the ml workflow.**

Use ´external_model´=True. Populate ´workflow_config´
and ´workflow_name´ along with the mandatory params.

**Case 3: Import a model published on another cluster. Use external_model=True,**

and provide the heritage information along with its heritage information
(´model_id´, ´model_name´, ´gt_id´, ´gt_name´, ´gt_version´, ´template_id´, ´template_name´, ´tagging_level´, ´labels´, ´location´, ´global_id´, ´orig_project_id´)

**`modify_published_model(project_id, publish_id, published_as, description)`**

Update ML Published model

Parameters

- `project_id` – Id of the Squirro project.
- `publish_id` – id of the published model.
- `published_as` – Name of the published model.
- `description` – Text to be shown describing the model.

**`unpublish_ml_model(project_id, publish_id)`**

Delete ML Model

Parameters

- `project_id` – Id of the Squirro project.
- `publish_id` – Id of the  published Model.
