Skip to content
Get started

Add

models.training_images.add(strmodel_id, TrainingImageAddParams**kwargs) -> TrainingImageAddResponse
POST/models/{modelId}/training-images

Add a new training image to the given modelId

ParametersExpand Collapse
model_id: str
original_assets: Optional[bool]

If set to true, returns the original asset without transformation

asset_id: Optional[str]

The asset ID to use as a training image (example: “asset_GTrL3mq4SXWyMxkOHRxlpw”). If provided, “data” and “name” parameters will be ignored.

asset_ids: Optional[Sequence[str]]

The asset IDs to use as training images (example: [“asset_GTrL3mq4SXWyMxkOHRxlpw”, “asset_GTrL3mq4SXWyMxkOHRxlpw”]) Used in batch mode, up to 10 asset IDs are allowed. Cannot be used with “assetId” or “data” and “name” parameters.

data: Optional[str]

The training image as a data URL (example: “data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=”)

name: Optional[str]

The original file name of the image (example: “my-training-image.jpg”)

preset: Optional[Literal["default", "style", "subject"]]

The preset to use for training images

One of the following:
"default"
"style"
"subject"
ReturnsExpand Collapse
class TrainingImageAddResponse:
training_image: TrainingImage
id: str

The training image ID (example: “asset_GTrL3mq4SXWyMxkOHRxlpw”)

automatic_captioning: str

Automatic captioning of the image

created_at: str

The training image upload date as an ISO string (example: “2023-02-03T11:19:41.579Z”)

description: str

Description for the image

download_url: str

The URL of the image

name: str

The original file name of the image (example: “my-training-image.jpg”)

Add

import os
from scenario_sdk import Scenario

client = Scenario(
    api_key=os.environ.get("SCENARIO_SDK_API_KEY"),  # This is the default and can be omitted
    api_secret=os.environ.get("SCENARIO_SDK_API_SECRET"),  # This is the default and can be omitted
)
response = client.models.training_images.add(
    model_id="modelId",
)
print(response.training_image)
{
  "trainingImage": {
    "id": "id",
    "automaticCaptioning": "automaticCaptioning",
    "createdAt": "createdAt",
    "description": "description",
    "downloadUrl": "downloadUrl",
    "name": "name"
  }
}
Returns Examples
{
  "trainingImage": {
    "id": "id",
    "automaticCaptioning": "automaticCaptioning",
    "createdAt": "createdAt",
    "description": "description",
    "downloadUrl": "downloadUrl",
    "name": "name"
  }
}