Harnessing the Power of Image Generation with asiryan/deliberate-v6 Cognitive Actions

22 Apr 2025
Harnessing the Power of Image Generation with asiryan/deliberate-v6 Cognitive Actions

In the realm of artificial intelligence, the ability to generate and manipulate images has opened up a world of possibilities for developers. The asiryan/deliberate-v6 Cognitive Actions offer a robust suite of tools to create and modify images using advanced techniques like Text2Img, Img2Img, and inpainting. By leveraging these pre-built actions, developers can integrate sophisticated image generation capabilities into their applications, enabling rich, customized visual content generation with ease.

Prerequisites

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

  • An API key for accessing the Cognitive Actions platform.
  • Familiarity with JSON structures, as the input and output will be in this format.

Authentication generally involves passing the API key in the request headers, allowing secure access to the image generation capabilities.

Cognitive Actions Overview

Generate and Modify Images with Deliberate V6

This action empowers developers to generate and modify images based on detailed text prompts. It provides various configuration options to achieve high-quality outputs tailored to specific needs.

Input

The action requires a structured JSON object as input, which includes the following fields:

  • mask (optional): URI of the mask image for inpainting mode.
  • seed (optional): An integer seed for random number generation.
  • image (optional): URI of the input image for Img2Img or inpainting modes.
  • width (optional): Output image width in pixels (default: 512, max: 1920).
  • height (optional): Output image height in pixels (default: 728, max: 1920).
  • prompt (required): Descriptive prompt guiding image generation.
  • strength (optional): Influences the dominance of the prompt vs. the image (default: 1).
  • scheduler (optional): Algorithm for scheduling steps during generation (default: "Euler A Karras").
  • guidanceScale (optional): Adherence to the prompt (default: 7.5, range: 0-10).
  • negativePrompt (optional): Specifies undesirable elements to exclude.
  • numberOfOutputs (optional): Number of output images (default: 1, range: 1-4).
  • numberOfInferenceSteps (optional): Steps in the inference process (default: 20, max: 100).

Example Input:

{
  "seed": 908,
  "width": 512,
  "height": 728,
  "prompt": "(NASA astronaut outfit) old chieftainman, on mars, (feathers headdress:1.2), by rutkowski, [by Ismail Inceoglu :: 0.3] dark theme, cinematic, detailed",
  "strength": 1,
  "scheduler": "Euler A Karras",
  "guidanceScale": 7.5,
  "negativePrompt": "[disfigured, poorly drawn], [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, mutated, blurry",
  "numberOfOutputs": 1,
  "numberOfInferenceSteps": 20
}

Output

The output will typically be a list of URIs pointing to the generated images. Here’s an example of what you might receive:

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/2a0faade-96df-449d-a06f-0f013568e0b6/56996473-460d-4f0c-ac66-ec99fa6beee2.png"
]

Conceptual Usage Example (Python)

Here’s how you might call this action using a hypothetical endpoint in 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 = "7c8c8271-0fbd-4b54-b399-712033a289c7" # Action ID for Generate and Modify Images with Deliberate V6

# Construct the input payload based on the action's requirements
payload = {
    "seed": 908,
    "width": 512,
    "height": 728,
    "prompt": "(NASA astronaut outfit) old chieftainman, on mars, (feathers headdress:1.2), by rutkowski, [by Ismail Inceoglu :: 0.3] dark theme, cinematic, detailed",
    "strength": 1,
    "scheduler": "Euler A Karras",
    "guidanceScale": 7.5,
    "negativePrompt": "[disfigured, poorly drawn], [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, mutated, blurry",
    "numberOfOutputs": 1,
    "numberOfInferenceSteps": 20
}

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 code snippet, replace the placeholders with your actual API key and endpoint. The action ID and structured input payload demonstrate how to correctly format your request for image generation.

Conclusion

The asiryan/deliberate-v6 Cognitive Actions provide a powerful toolkit for developers looking to enhance their applications with advanced image generation capabilities. By utilizing features like customizable prompts and various configuration settings, you can create stunning visuals tailored to your project's needs. Explore the possibilities, experiment with different inputs, and unlock the creative potential of AI-driven image generation!