# Training Images ## Add **post** `/models/{modelId}/training-images` Add a new training image to the given `modelId` ### Path Parameters - `modelId: string` ### Query Parameters - `originalAssets: optional boolean` If set to true, returns the original asset without transformation ### Body Parameters - `assetId: optional string` The asset ID to use as a training image (example: "asset_GTrL3mq4SXWyMxkOHRxlpw"). If provided, "data" and "name" parameters will be ignored. - `assetIds: optional array of string` 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 string` The training image as a data URL (example: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=") - `name: optional string` The original file name of the image (example: "my-training-image.jpg") - `preset: optional "default" or "style" or "subject"` The preset to use for training images - `"default"` - `"style"` - `"subject"` ### Returns - `trainingImage: object { id, automaticCaptioning, createdAt, 3 more }` - `id: string` The training image ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `automaticCaptioning: string` Automatic captioning of the image - `createdAt: string` The training image upload date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `description: string` Description for the image - `downloadUrl: string` The URL of the image - `name: string` The original file name of the image (example: "my-training-image.jpg") ### Example ```http curl https://api.cloud.scenario.com/v1/models/$MODEL_ID/training-images \ -H 'Content-Type: application/json' \ -u "$SCENARIO_SDK_API_KEY:SCENARIO_SDK_API_SECRET" \ -d '{}' ``` #### Response ```json { "trainingImage": { "id": "id", "automaticCaptioning": "automaticCaptioning", "createdAt": "createdAt", "description": "description", "downloadUrl": "downloadUrl", "name": "name" } } ``` ## Replace Pairs **put** `/models/{modelId}/training-images/pairs` Replace all training image pairs for the given `modelId` ### Path Parameters - `modelId: string` ### Body Parameters - `body: array of object { instruction, sourceId, targetId }` Array of training image pairs - `instruction: optional string` The instruction for the image pair, source to target - `sourceId: optional string` The source asset ID (must be a training asset) - `targetId: optional string` The target asset ID (must be a training asset) ### Returns - `count: number` Number of training image pairs - `pairs: array of object { instruction, sourceId, targetId }` Array of training image pairs - `instruction: optional string` The instruction for the image pair, source to target - `sourceId: optional string` The source asset ID (must be a training asset) - `targetId: optional string` The target asset ID (must be a training asset) ### Example ```http curl https://api.cloud.scenario.com/v1/models/$MODEL_ID/training-images/pairs \ -X PUT \ -H 'Content-Type: application/json' \ -u "$SCENARIO_SDK_API_KEY:SCENARIO_SDK_API_SECRET" \ -d '[ { "instruction": "instruction", "sourceId": "sourceId", "targetId": "targetId" } ]' ``` #### Response ```json { "count": 0, "pairs": [ { "instruction": "instruction", "sourceId": "sourceId", "targetId": "targetId" } ] } ``` ## Replace **put** `/models/{modelId}/training-images/{trainingImageId}` Replace the given `trainingImageId` for the given `modelId` ### Path Parameters - `modelId: string` - `trainingImageId: string` ### Query Parameters - `originalAssets: optional boolean` If set to true, returns the original asset without transformation ### Body Parameters - `assetId: optional string` The asset ID to use as a training image (example: "asset_GTrL3mq4SXWyMxkOHRxlpw"). If provided, "data" and "name" parameters will be ignored. - `assetIds: optional array of string` 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 string` The training image as a data URL (example: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=") - `name: optional string` The original file name of the image (example: "my-training-image.jpg") - `preset: optional "default" or "style" or "subject"` The preset to use for training images - `"default"` - `"style"` - `"subject"` ### Returns - `trainingImage: object { id, automaticCaptioning, createdAt, 3 more }` - `id: string` The training image ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `automaticCaptioning: string` Automatic captioning of the image - `createdAt: string` The training image upload date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `description: string` Description for the image - `downloadUrl: string` The URL of the image - `name: string` The original file name of the image (example: "my-training-image.jpg") ### Example ```http curl https://api.cloud.scenario.com/v1/models/$MODEL_ID/training-images/$TRAINING_IMAGE_ID \ -X PUT \ -H 'Content-Type: application/json' \ -u "$SCENARIO_SDK_API_KEY:SCENARIO_SDK_API_SECRET" \ -d '{}' ``` #### Response ```json { "trainingImage": { "id": "id", "automaticCaptioning": "automaticCaptioning", "createdAt": "createdAt", "description": "description", "downloadUrl": "downloadUrl", "name": "name" } } ``` ## Delete **delete** `/models/{modelId}/training-images/{trainingImageId}` Delete the given `trainingImageId` from the given `modelId` ### Path Parameters - `modelId: string` - `trainingImageId: string` ### Example ```http curl https://api.cloud.scenario.com/v1/models/$MODEL_ID/training-images/$TRAINING_IMAGE_ID \ -X DELETE \ -u "$SCENARIO_SDK_API_KEY:SCENARIO_SDK_API_SECRET" ``` #### Response ```json {} ``` ## Domain Types ### Training Image Add Response - `TrainingImageAddResponse object { trainingImage }` - `trainingImage: object { id, automaticCaptioning, createdAt, 3 more }` - `id: string` The training image ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `automaticCaptioning: string` Automatic captioning of the image - `createdAt: string` The training image upload date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `description: string` Description for the image - `downloadUrl: string` The URL of the image - `name: string` The original file name of the image (example: "my-training-image.jpg") ### Training Image Replace Pairs Response - `TrainingImageReplacePairsResponse object { count, pairs }` - `count: number` Number of training image pairs - `pairs: array of object { instruction, sourceId, targetId }` Array of training image pairs - `instruction: optional string` The instruction for the image pair, source to target - `sourceId: optional string` The source asset ID (must be a training asset) - `targetId: optional string` The target asset ID (must be a training asset) ### Training Image Replace Response - `TrainingImageReplaceResponse object { trainingImage }` - `trainingImage: object { id, automaticCaptioning, createdAt, 3 more }` - `id: string` The training image ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw") - `automaticCaptioning: string` Automatic captioning of the image - `createdAt: string` The training image upload date as an ISO string (example: "2023-02-03T11:19:41.579Z") - `description: string` Description for the image - `downloadUrl: string` The URL of the image - `name: string` The original file name of the image (example: "my-training-image.jpg") ### Training Image Delete Response - `TrainingImageDeleteResponse = unknown`