Generate Stunning Images with the WAI-NSFW-Illustrious V12 Cognitive Action

24 Apr 2025
Generate Stunning Images with the WAI-NSFW-Illustrious V12 Cognitive Action

In this blog post, we’ll explore the capabilities of the WAI-NSFW-Illustrious V12 Cognitive Action, which allows developers to generate high-quality illustrated images. This action leverages the WAI-NSFW-Illustrious-SDXL-v12 model to create visually striking images based on customizable parameters. By using these pre-built Cognitive Actions, you can effortlessly integrate advanced image generation functionalities into your applications.

Prerequisites

Before diving into the integration of the WAI-NSFW-Illustrious V12 Cognitive Action, ensure you have the following set up:

  • An API key for the Cognitive Actions platform, which is essential for authentication.
  • Basic knowledge of making HTTP requests and handling JSON data.

Conceptually, authentication typically involves passing your API key in the request headers, allowing you to securely access the Cognitive Actions service.

Cognitive Actions Overview

Generate Illustrated Image

The Generate Illustrated Image action is designed to produce high-quality illustrated images using the WAI-NSFW-Illustrious-SDXL-v12 model. You can customize the image generation process with a variety of adjustable parameters, ensuring you achieve the desired output.

Input

The input for this action requires a JSON object with the following parameters:

  • seed (integer): The seed for generation (default is -1, which indicates a random seed).
  • model (string): Specifies the model to use, defaulting to WAI-NSFW-Illustrious-SDXL-v12.
  • steps (integer): The number of steps in the generation process (default is 30, ranges from 1 to 100).
  • width (integer): The width of the generated image in pixels (default is 1024, ranges from 1 to 4096).
  • height (integer): The height of the generated image in pixels (default is 1024, ranges from 1 to 4096).
  • prompt (string): The prompt to guide image generation (default is a descriptive prompt for what to generate).
  • batchSize (integer): Number of images to generate simultaneously (default is 1, maximum 4).
  • scheduler (string): Scheduler type for the generation process (default is Euler a).
  • clipSkipLayers (integer): Number of CLIP layers to skip (default is 2).
  • negativePrompt (string): Elements to avoid in the generation (default is nsfw, naked).
  • configurationScale (number): CFG scale affecting the adherence to the prompt (default is 7).
  • prependInitialPrompt (boolean): If true, prepends a quality-enhancing preprompt (default is true).
  • guidanceRescaleAmount (number): Adjusts CFG-generated noise (default is 1).
  • variationalAutoencoder (string): Determines the VAE used (default is default).
  • patternAffinityGuidanceScale (number): Enhances results (default is 0).

Example Input:

{
  "seed": -1,
  "model": "WAI-NSFW-Illustrious-SDXL-v12",
  "steps": 30,
  "width": 1024,
  "height": 1024,
  "prompt": "street, 1girl, dark-purple short hair, purple eyes, medium breasts, cleavage, casual clothes, smile, V",
  "batchSize": 1,
  "scheduler": "Euler a",
  "clipSkipLayers": 2,
  "negativePrompt": "nsfw, naked",
  "configurationScale": 7,
  "prependInitialPrompt": true,
  "guidanceRescaleAmount": 1,
  "variationalAutoencoder": "default",
  "patternAffinityGuidanceScale": 0
}

Output

The output of this action will typically return a JSON array containing the URLs of the generated images.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/94d374cb-2121-4075-9cff-82a87eeef219/b4d28f1b-2c35-48ed-b633-19d41c1044a6.png"
]

Conceptual Usage Example (Python)

Here’s a conceptual example of how you might call the Generate Illustrated Image 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 = "102b025c-db99-4b5e-807c-f047e51650b3"  # Action ID for Generate Illustrated Image

# Construct the input payload based on the action's requirements
payload = {
    "seed": -1,
    "model": "WAI-NSFW-Illustrious-SDXL-v12",
    "steps": 30,
    "width": 1024,
    "height": 1024,
    "prompt": "street, 1girl, dark-purple short hair, purple eyes, medium breasts, cleavage, casual clothes, smile, V",
    "batchSize": 1,
    "scheduler": "Euler a",
    "clipSkipLayers": 2,
    "negativePrompt": "nsfw, naked",
    "configurationScale": 7,
    "prependInitialPrompt": true,
    "guidanceRescaleAmount": 1,
    "variationalAutoencoder": "default",
    "patternAffinityGuidanceScale": 0
}

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 Python code snippet, we define the action ID and input payload according to the requirements of the Generate Illustrated Image action. We then make a POST request to the (hypothetical) Cognitive Actions endpoint, passing the action ID and input data in the request body.

Conclusion

The WAI-NSFW-Illustrious V12 Cognitive Action provides developers with a powerful tool for generating illustrated images tailored to specific prompts and parameters. With the flexibility to adjust numerous settings, you can create unique visuals that enhance your applications. Start integrating this action today to unlock the potential of AI-driven image generation!