Skip to main content

Upload Dataset Generated Image

Uploads a previously generated image from Leonardo AI to a dataset for training custom models.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.

Inputs

  • Connection Id (String) - Connection ID from the Connect node (optional if API Key credentials are provided directly).
  • Dataset ID (String) - ID of the dataset to upload the image to (from Create Dataset node).
  • Generated Image Id (String) - ID of the generated image to add to the dataset.

Options

  • API Key - Leonardo AI API key (optional if using Connection ID).

Outputs

  • Response (String) - ID of the uploaded image in the dataset.

How It Works

The Upload Dataset Generated Image node adds a previously generated image to a dataset. When executed, the node:

  1. Validates the dataset ID and generated image ID are not empty
  2. Sends a request to add the generated image to the dataset
  3. Returns the image ID in the dataset
  4. The image becomes part of the dataset for model training

Requirements

  • Valid Leonardo AI API key (via Connection ID or credentials)
  • Valid dataset ID from a Create Dataset node
  • Valid generated image ID from a previous Create Generation
  • Permission to access the generated image (must be the owner)

Error Handling

The node will return specific errors in the following cases:

  • Empty dataset ID - "Dataset ID cannot be empty. Please provide a valid dataset ID."
  • Empty generated image ID - "Generated Image ID cannot be empty. Please provide a valid generated image ID."
  • API error - "Failed to upload generated image to dataset. API response: {{details}}"

Usage Examples

Add Generated Variations to Dataset

Use generated images to expand your training dataset:

  1. Create Generation with a base prompt
  2. Get Generation and extract image IDs
  3. For each generated image:
    • Upload Dataset Generated Image to add it to the dataset
  4. Use the expanded dataset to train a better model

Iterative Dataset Building

Build a dataset using your own generations:

  1. Create Dataset for a specific style
  2. Generate 10 images with similar style
  3. Loop through generated image IDs:
    • Upload Dataset Generated Image for each
  4. Create Model from the dataset
  5. Use the model to generate more refined images

Build Dataset from Best Generations

Curate a dataset from high-quality generations:

// Array of generated image IDs
const bestGenerations = [
'gen-image-id-1',
'gen-image-id-2',
'gen-image-id-3'
// Only your best results
];

const datasetId = 'your-dataset-id';

// Upload each to the dataset
bestGenerations.forEach(imageId => {
// Use Upload Dataset Generated Image
// with datasetId and imageId
});

Synthetic Dataset Creation

Create a training dataset entirely from generated images:

  1. Create Dataset: "Synthetic Landscapes"
  2. Generate 15-20 landscape images with consistent style
  3. Upload each generated image to the dataset
  4. Train a custom model from these synthetic examples
  5. Use the model to create variations

Combine Generated and Real Images

Build a hybrid dataset:

  1. Create Dataset
  2. Upload Dataset Image (real photos): 5-10 images
  3. Generate similar images using existing models
  4. Upload Dataset Generated Image (generated): 5-10 images
  5. Train model on combined dataset

Usage Notes

  • Only images you generated can be added to your datasets
  • Generated image IDs come from the Create Generation output
  • Extract image IDs from the generation object's generated_images array
  • Useful for creating synthetic training datasets
  • Can combine with real images uploaded via Upload Dataset Image
  • Helps expand datasets without collecting more real images
  • The generated image must still exist (not deleted)
  • Good for creating variations of existing concepts
  • Can iteratively improve datasets by generating and adding better examples
  • Synthetic datasets can produce creative and consistent models
  • Consider the quality of generated images - only add good examples
  • The dataset can mix real and generated images
  • Generated images remain in their original generation as well