Create Engaging Kids Coloring Pages with LazyMindz SDXL Cognitive Actions

23 Apr 2025
Create Engaging Kids Coloring Pages with LazyMindz SDXL Cognitive Actions

Creating captivating and interactive content for children can be challenging, but with the LazyMindz SDXL Cognitive Actions, you can effortlessly generate customized coloring pages tailored to young audiences. This API provides a powerful action that uses a fine-tuned SDXL model optimized for fast inference, allowing developers to integrate this functionality into their applications seamlessly.

Prerequisites

To get started with the LazyMindz SDXL Cognitive Actions, you'll need to ensure you have the following:

  • An API key for the Cognitive Actions platform, which will be used for authentication when making requests.
  • Familiarity with handling JSON payloads, as you'll be sending and receiving data in this format.

Authentication typically involves passing your API key in the headers of your requests.

Cognitive Actions Overview

Generate Kids Coloring Page

Description: This action allows you to create a customized coloring page for kids using an image generation model. It is particularly designed for image inpainting and img2img tasks.

Category: Image Generation

Input: The action requires a structured input JSON, which can include various properties to customize the output. Below is the schema and an example input:

{
  "mask": "uri-to-mask-image",
  "seed": 12345,
  "image": "uri-to-base-image",
  "width": 1024,
  "height": 1024,
  "prompt": "An astronaut riding a unicorn in the style of TOK, colouring page, white background",
  "scaleFactor": 0.6,
  "customWeights": "",
  "guidanceScale": 2,
  "schedulerType": "LCM",
  "applyWatermark": true,
  "inferenceSteps": 6,
  "negativePrompt": "",
  "numberOfOutputs": 1,
  "promptIntensity": 0.8,
  "disableSafetyChecker": false
}

Example Input:

{
  "width": 1024,
  "height": 1024,
  "prompt": "An astronaut riding a unicorn in the style of TOK, colouring page, white background",
  "scaleFactor": 0.6,
  "guidanceScale": 2,
  "schedulerType": "LCM",
  "applyWatermark": true,
  "inferenceSteps": 6,
  "negativePrompt": "",
  "numberOfOutputs": 1,
  "promptIntensity": 0.8
}

Output: Once executed, the action returns an array of URLs pointing to the generated coloring pages. Here’s an example output for successful execution:

[
  "https://assets.cognitiveactions.com/invocations/d95cf009-6e23-48ae-81e7-4b03a53f67e0/88973c7a-36a6-45d6-9264-b6d2b593eecd.png"
]

Conceptual Usage Example (Python): Here's how you might structure a Python request to the Cognitive Actions endpoint to generate a kids coloring page:

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 = "0487b204-0adf-4bb5-919e-0f7e337a0cbf"  # Action ID for Generate Kids Coloring Page

# Construct the input payload based on the action's requirements
payload = {
    "width": 1024,
    "height": 1024,
    "prompt": "An astronaut riding a unicorn in the style of TOK, colouring page, white background",
    "scaleFactor": 0.6,
    "guidanceScale": 2,
    "schedulerType": "LCM",
    "applyWatermark": True,
    "inferenceSteps": 6,
    "negativePrompt": "",
    "numberOfOutputs": 1,
    "promptIntensity": 0.8
}

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, you’ll need to replace the placeholder API key and endpoint with your actual values. The payload variable should be structured according to the action's input schema. The example shows how to handle the response, including error handling.

Conclusion

The LazyMindz SDXL Cognitive Action for generating kids coloring pages opens up exciting possibilities for developers looking to create engaging content. With customizable parameters and a straightforward API, you can integrate this action into your applications to provide unique and fun experiences for children. Try it out and explore the creativity that awaits!