This feature is available from 2.1.0 and currently in preview state and subject to change.
Model configuration is currently available for text-to-image based models and will be extended to other types of models, such as text-to-text and image-to-image, in the future.
Image IO
Image IO is available from 2.1.0
Magnolia AI Accelerator Image IO enables a flexible way for developers to add image models such as DallE·2/3 and Flux for AI powered image generation.
Image models can be added to your light module by creating a aiTextToImageModels folder and adding a <your-image-to-image-model>.yaml file with the following configuration:
Parameters present in this configuration will have a UI representation and should represent the configurable parameters of the image model. Available parameter types are:
STRING
PROMPT, // Special STRING type to render a prompt field
NUMBER
ENUM
2
The executor script is a script that will be executed by the AI accelerator to and should include API calls against the image model API.
The script is required to have a default export class that has the method generateImage(appState, parameters).
Example:
exportdefaultclass{
/**
*
* @param appState contains Application State (provided by AI Accelerator)
* @param parameters contains all configured model parameters i.e (2)
* @returns {{b64_json: String, width: Number, height: Number, prompt: String}[]}>
*/async generateImage(appState, parameters) {
const images = callImageModelApi(parameters);
return images;
}
}Copy
modelName:Dall-E·2modelId:dall-e-2appId:dall-e-2modelParameters:prompt:type:PROMPTrequired:truedescription:Theprompttogenerateanimagefrom.n:type:NUMBERdescription:|
The number of images to generate. Must be between 1 and 10.
defaultValue:1size:type:ENUMdescription:|
The size of the generated images. Defaults to 1024x1024
Must be one of 1024x1024, 1792x1024, or 1024x1792
enumValues:[1024x1024,1792x1024,1024x1792]defaultValue:1024x1024scriptLocation:/ai-accelerator-openai/webresources/DallEImageModelHandler.jsCopy
modelName:OpenAIDall-E·3modelId:dall-e-3appId:dall-e-3modelParameters:prompt:type:PROMPTrequired:truedescription:Theprompttogenerateanimagefrom.size:type:ENUMdescription:|
The size of the generated images. Defaults to 1024x1024
Must be one of 1024x1024, 1792x1024, or 1024x1792
enumValues:[1024x1024,1792x1024,1024x1792]defaultValue:1024x1024style:type:ENUMdescription:|
The style of the generated images. Must be one of vivid or natural. Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images.
enumValues:[vivid,natural]defaultValue:vividquality:type:ENUMdescription:|
The quality of the image that will be generated. hd creates images with finer details and greater consistency across the image
enumValues:[standard,hd]defaultValue:standardscriptLocation:/ai-accelerator-openai/webresources/DallEImageModelHandler.jsCopy
modelName:FLUX.1[dev]modelId:devappId:fal-ai/fluxmodelParameters:prompt:type:PROMPTrequired:truedescription:Theprompttogenerateanimagefrom.image_size:type:ENUMdescription:|
The size of the generated image. Default value: landscape_4_3
Possible enum values: square_hd, square, portrait_4_3, portrait_16_9, landscape_4_3, landscape_16_9
enumValues:[square_hd,square,portrait_4_3,portrait_16_9,landscape_4_3,landscape_16_9]defaultValue:landscape_4_3num_outputs:type:NUMBERdescription:"The number of images to generate. Default value: 1"defaultValue:1guidance_scale:type:NUMBERdescription:"The CFG (Classifier Free Guidance) scale is a measure of how close you want the model to stick to your prompt when looking for a related image to show you. Default value: 3.5"defaultValue:3.5num_inference_steps:type:NUMBERdescription:"The number of inference steps to perform. Default value: 28"defaultValue:28scriptLocation:/ai-accelerator-fal-ai/webresources/FluxImageModelHandler.jsCopy
modelName:FLUX.1.1[pro]modelId:v1.1appId:fal-ai/flux-promodelParameters:prompt:type:PROMPTrequired:truedescription:Theprompttogenerateanimagefrom.image_size:type:ENUMdescription:|
The size of the generated image. Default value: landscape_4_3
Possible enum values: square_hd, square, portrait_4_3, portrait_16_9, landscape_4_3, landscape_16_9
enumValues:[square_hd,square,portrait_4_3,portrait_16_9,landscape_4_3,landscape_16_9]defaultValue:landscape_4_3num_outputs:type:NUMBERdescription:"The number of images to generate. Default value: 1"defaultValue:1guidance_scale:type:NUMBERdescription:"The CFG (Classifier Free Guidance) scale is a measure of how close you want the model to stick to your prompt when looking for a related image to show you. Default value: 3.5"defaultValue:3.5num_inference_steps:type:NUMBERdescription:"The number of inference steps to perform. Default value: 28"defaultValue:28scriptLocation:/ai-accelerator-fal-ai/webresources/FluxImageModelHandler.jsCopy