Updated on 2024-10-29 GMT+08:00

Publishing a Workflow to AI Gallery

You can publish workflows to AI Gallery and share them with other users. To do so, run this code:

workflow.release_to_gallery()

Once the release is done, you can visit AI Gallery to see the asset details. The asset permission is set to private by default, but you can change it if you want.

  1. Go to AI Gallery.
  2. Choose My Gallery > My Assets > Workflow.
  3. In the My Publishes tab, view the workflow published to AI Gallery.
  4. Click the workflow name to view the workflow details.

The release_to_gallery() method contains the following input parameters.

Parameter

Description

Mandatory

Type

content_id

Workflow asset ID

No

str

version

Version number of the workflow asset. The format is x.x.x.

No

str

desc

Description of the workflow asset version

No

str

title

Workflow asset name. If this parameter is not specified, the workflow name is used by default.

No

str

visibility

Visibility of the workflow asset. The value can be public, group (whitelist), and private (visible only to you). The default value is private.

No

str

group_users

Whitelist. This parameter is mandatory only when visibility is set to group. You can only enter domain_id.

No

list[str]

You can use the method in two ways based on the input parameters:

  • workflow.release_to_gallery(title="Asset name") publishes a new workflow asset with version 1.0.0. If the workflow includes an algorithm that is not from AI Gallery, it also publishes the algorithm to AI Gallery with version 1.0.0.
  • workflow.release_to_gallery(content_id="**", title="Asset name") publishes a new version based on the specified workflow asset. The version number increases automatically. If the workflow includes an AI Gallery algorithm, it updates the algorithm asset with a higher version number.

Workflow asset whitelist setting:

You can specify the visibility and group_users fields of the release_to_gallery method when you publish an asset for the first time. To change the whitelist for accessing a certain asset, use this command:

from modelarts import workflow as wf

# Add specified whitelist users.
wf.add_whitelist_users(content_id="**", version_num="*.*.*", user_groups=["**", "**"])

# Delete specified whitelist users.
wf.delete_whitelist_users(content_id="**", version_num="*.*.*", user_groups=["**", "**"])

When you modify the whitelist for a workflow asset, the system automatically obtains the information of the algorithm asset that the workflow version depends on and sets the whitelist for the algorithm asset as well.