Create Stunning Images with dlartes/kytfrlino Cognitive Actions

22 Apr 2025
Create Stunning Images with dlartes/kytfrlino Cognitive Actions

In the realm of image generation, leveraging advanced techniques can elevate your applications significantly. The dlartes/kytfrlino specification offers powerful Cognitive Actions designed for creating visually detailed images using inpainting techniques. With options for image masks, model selection, and various parameters for customization, these pre-built actions streamline the integration process for developers looking to enhance their applications with robust image generation capabilities.

Prerequisites

Before diving into the Cognitive Actions, ensure you have the following:

  • An API key for the Cognitive Actions platform.
  • Familiarity with making HTTP requests to interact with the API.
  • Basic knowledge of JSON to structure your input and handle the output.

Authentication typically involves passing your API key in the request headers to authorize access to the Cognitive Actions.

Cognitive Actions Overview

Generate Inpainting-Enhanced Images

The Generate Inpainting-Enhanced Images action allows you to create intricate images through advanced inpainting techniques. You can provide an image mask and choose between different models, ensuring that you have fine control over the image generation parameters such as dimensions, quality, and output format.

  • Category: image-generation

Input

The input for this action is structured as follows:

FieldTypeRequiredDescription
promptstringYesText prompt guiding image generation.
maskstringNoURI to an image mask for inpainting.
seedintegerNoRandom seed for reproducible results.
imagestringNoURI to an input image for img2img mode.
widthintegerNoImage width, only applicable if aspect_ratio is custom.
heightintegerNoImage height, only applicable if aspect_ratio is custom.
goFastbooleanNoOptimize for speed with a fast model.
outputCountintegerNoNumber of images to generate (1-4).
selectedModelstringNoModel selection; options: 'dev', 'schnell'.
imageAspectRatiostringNoAspect ratio of the generated image.
imageOutputFormatstringNoFormat for generated images: 'webp', 'jpg', 'png'.
imageOutputQualityintegerNoQuality of the generated image (0-100).
inferenceStepCountintegerNoNumber of denoising steps for image generation.
additionalLoraScalenumberNoStrength of the secondary LoRA application.
additionalLoraWeightsstringNoCustom weights for secondary LoRA.
approximateMegapixelsstringNoEstimate of the image's megapixel count.
diffusionGuidanceScalenumberNoAdjusts guidance scale during diffusion.
imgToImgPromptStrengthnumberNoLevel of prompt influence in img2img mode.
isSafetyCheckerDisabledbooleanNoToggle to disable safety checks for generated images.

Example Input:

{
  "prompt": "Kytlino Beautiful professional photo of a beautiful young Brazilian cyberpunk wearing a soldier's uniform, with a heroine's cape, the Brazilian flag printed on her chest, holding a large red letter X in her hand. The photo is frontal, 80mm",
  "loraScale": 1,
  "outputCount": 2,
  "selectedModel": "dev",
  "imageAspectRatio": "1:1",
  "imageOutputFormat": "png",
  "imageOutputQuality": 90,
  "inferenceStepCount": 41,
  "additionalLoraScale": 1,
  "diffusionGuidanceScale": 3.5,
  "imgToImgPromptStrength": 0.9
}

Output

The action typically returns an array of URLs pointing to the generated images. Each URL links to a different output image based on the specified parameters.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/a7681850-5b99-43c1-8696-5c31d2589f03/c464b4c9-48f3-46f9-8fcb-6ae964469dd3.png",
  "https://assets.cognitiveactions.com/invocations/a7681850-5b99-43c1-8696-5c31d2589f03/14ea908a-9350-4f1e-8d15-6c1442281dd4.png"
]

Conceptual Usage Example (Python)

Here’s a conceptual Python code snippet to demonstrate how you might call this action:

import requests
import json

# Replace with your Cognitive Actions API key and endpoint
COGNITIVE_ACTIONS_API_KEY = "YOUR_COGNITIVE_ACTIONS_API_KEY"
COGNITIVE_ACTIONS_EXECUTE_URL = "https://api.cognitiveactions.com/actions/execute" # Hypothetical endpoint

action_id = "a4504bd3-b8a8-4ff1-bbe2-f625e8c002db"  # Action ID for Generate Inpainting-Enhanced Images

# Construct the input payload based on the action's requirements
payload = {
    "prompt": "Kytlino Beautiful professional photo of a beautiful young Brazilian cyberpunk wearing a soldier's uniform, with a heroine's cape, the Brazilian flag printed on her chest, holding a large red letter X in her hand. The photo is frontal, 80mm",
    "loraScale": 1,
    "outputCount": 2,
    "selectedModel": "dev",
    "imageAspectRatio": "1:1",
    "imageOutputFormat": "png",
    "imageOutputQuality": 90,
    "inferenceStepCount": 41,
    "additionalLoraScale": 1,
    "diffusionGuidanceScale": 3.5,
    "imgToImgPromptStrength": 0.9
}

headers = {
    "Authorization": f"Bearer {COGNITIVE_ACTIONS_API_KEY}",
    "Content-Type": "application/json"
}

try:
    response = requests.post(
        COGNITIVE_ACTIONS_EXECUTE_URL,
        headers=headers,
        json={"action_id": action_id, "inputs": payload}
    )
    response.raise_for_status()

    result = response.json()
    print("Action executed successfully:")
    print(json.dumps(result, indent=2))

except requests.exceptions.RequestException as e:
    print(f"Error executing action {action_id}: {e}")
    if e.response is not None:
        print(f"Response status: {e.response.status_code}")
        try:
            print(f"Response body: {e.response.json()}")
        except json.JSONDecodeError:
            print(f"Response body: {e.response.text}")

In this code snippet, replace the placeholder for the API key and endpoint with your actual values. The action_id corresponds to the Generate Inpainting-Enhanced Images action. The payload is structured to match the required input schema for the action.

Conclusion

The dlartes/kytfrlino Cognitive Actions provide developers with powerful tools for generating intricate images leveraging inpainting techniques. With customizable parameters and model selections, you can create stunning visuals that cater to your application's needs. Explore the possibilities of integrating these actions into your projects to enhance user experiences and creative outputs. Happy coding!