Generate Stunning Custom Images with the egcel/acidloveydona Cognitive Actions

22 Apr 2025
Generate Stunning Custom Images with the egcel/acidloveydona Cognitive Actions

In today's digital landscape, custom image generation can significantly enhance applications, whether for creative projects, marketing content, or social media engagement. The egcel/acidloveydona Cognitive Actions provide a powerful way to generate unique images using advanced inpainting techniques. By leveraging adjustable parameters, developers can create tailored images that meet their specific needs, all while enjoying optimized performance.

Prerequisites

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

  • API Key: You will need a valid API key to authenticate your requests to the Cognitive Actions platform.
  • Setup: Familiarize yourself with your development environment and ensure that you can make HTTP requests to external APIs.

Authentication typically involves passing your API key in the request headers to access the cognitive actions.

Cognitive Actions Overview

Generate Custom Image with Inpainting

The Generate Custom Image with Inpainting action is designed to generate custom images using advanced inpainting techniques, allowing for fine-tuning through various adjustable parameters such as mask, seed, width, height, aspect ratio, and quality. This action supports multiple image outputs and is optimized for speed with two models: 'dev' and 'schnell'.

Input

The input schema for this action requires a JSON payload structured as follows:

  • prompt (required): A descriptive text to guide the image generation.
  • mask (optional): A URI of an image mask for inpainting mode.
  • seed (optional): An integer to produce reproducible results.
  • image (optional): An input image for inpainting mode.
  • model (optional): Model type, either 'dev' or 'schnell'.
  • width (optional): Width of the generated image (custom aspect ratio only).
  • height (optional): Height of the generated image (custom aspect ratio only).
  • imageFormat (optional): Format of the output images (webp, jpg, or png).
  • imageQuality (optional): Quality of the output image, ranging from 0 to 100.
  • numberOfOutputs (optional): Number of images to generate.

Example Input:

{
  "model": "dev",
  "prompt": "acidloveydona A stylish young woman sits casually on an escalator...",
  "imageFormat": "webp",
  "imageQuality": 90,
  "promptImpact": 0.8,
  "mainLoraScale": 1,
  "numberOfOutputs": 4,
  "imageAspectRatio": "1:1",
  "additionalLoraScale": 1,
  "inferenceStepsCount": 50,
  "diffusionGuidanceScale": 3.5
}

Output

The action typically returns an array of URLs pointing to the generated images:

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/cb8421be-f5f1-4611-a580-c226411df4ba/efcfff43-3772-4841-8c9c-760b0e46de8d.webp",
  "https://assets.cognitiveactions.com/invocations/cb8421be-f5f1-4611-a580-c226411df4ba/0dfd3e7f-683f-49dd-a185-21aeb43ef39f.webp",
  "https://assets.cognitiveactions.com/invocations/cb8421be-f5f1-4611-a580-c226411df4ba/84d1ec20-192d-461b-b357-8a1817b7c8e4.webp",
  "https://assets.cognitiveactions.com/invocations/cb8421be-f5f1-4611-a580-c226411df4ba/f392d91c-d5c2-4701-9e1d-a3486e78062f.webp"
]

Conceptual Usage Example (Python)

Here’s how you might call the Generate Custom Image with Inpainting action using Python:

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 = "cb6a99ca-ffd6-40eb-91bd-af58ad2c7549" # Action ID for Generate Custom Image with Inpainting

# Construct the input payload based on the action's requirements
payload = {
    "model": "dev",
    "prompt": "acidloveydona A stylish young woman sits casually on an escalator...",
    "imageFormat": "webp",
    "imageQuality": 90,
    "promptImpact": 0.8,
    "mainLoraScale": 1,
    "numberOfOutputs": 4,
    "imageAspectRatio": "1:1",
    "additionalLoraScale": 1,
    "inferenceStepsCount": 50,
    "diffusionGuidanceScale": 3.5
}

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} # Hypothetical structure
    )
    response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx)

    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 example, replace the YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The payload variable is where you structure the input according to the action's schema. The endpoint URL is illustrative, emphasizing that you should customize it based on your integration.

Conclusion

The egcel/acidloveydona Cognitive Actions empower developers to create stunning, customized images through powerful inpainting techniques. With a variety of adjustable parameters, you can tailor your image outputs to fit specific needs and styles. Whether for personal projects or commercial applications, integrating these actions into your workflows can significantly enhance your creative capabilities. Explore the possibilities, and start generating unique images today!