Create Custom Puppet Images with LazyMindz SDXL Lora Flateric Cognitive Actions

24 Apr 2025
Create Custom Puppet Images with LazyMindz SDXL Lora Flateric Cognitive Actions

In the realm of image generation, the lazymindz/sdxl-lora-flateric provides developers with powerful Cognitive Actions to create stunning visuals effortlessly. The primary action, "Generate Puppet Character Image with Inpainting," allows developers to generate images featuring Flat Eric, a beloved puppet character, using advanced inpainting techniques. With this action, you can customize image dimensions, select refinement methods, and control scheduling algorithms, enabling precise image creation tailored to your needs.

Prerequisites

To start using the Cognitive Actions from the lazymindz/sdxl-lora-flateric API, you'll need to have:

  • An API key for authentication.
  • A basic understanding of how to make HTTP requests and handle JSON data.
  • Familiarity with Python, as we will illustrate usage through Python code snippets.

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

Cognitive Actions Overview

Generate Puppet Character Image with Inpainting

This action generates images of Flat Eric using inpainting techniques, allowing for a high degree of customization.

Category: Image Generation

Input

The input for this action consists of various fields that allow you to customize the image output. Here is the schema breakdown:

  • mask (string): Input mask for inpaint mode (URI format).
  • seed (integer): Random seed for generation; leave blank to randomize.
  • image (string): URI of the input image for img2img or inpaint mode.
  • width (integer, default: 1024): Width of the output image in pixels.
  • height (integer, default: 1024): Height of the output image in pixels.
  • prompt (string, default: "An astronaut riding a rainbow unicorn"): Text prompt to guide image generation.
  • refine (string, default: "no_refiner"): Method to refine the generated image.
  • loraScale (number, default: 0.6): Scale applied to LoRA models (0 to 1).
  • scheduler (string, default: "K_EULER"): Method for image denoising scheduling.
  • loraWeights (string): Path to custom LoRA weights.
  • guidanceScale (number, default: 7.5): Scale for classifier-free guidance (1 to 50).
  • applyWatermark (boolean, default: true): Flag to apply a watermark.
  • negativePrompt (string): Negative text prompt for influencing generation.
  • promptStrength (number, default: 0.8): Strength of the prompt (0 to 1).
  • numberOfOutputs (integer, default: 1): Number of images to generate (1 to 4).
  • highNoiseFraction (number, default: 0.8): Fraction of noise for 'expert_ensemble_refiner'.
  • numberOfRefineSteps (integer): Number of refinement steps for 'base_image_refiner'.
  • disableSafetyChecker (boolean, default: false): Flag to disable the safety checker.
  • numberOfInferenceSteps (integer, default: 50): Total steps for the denoising process (1 to 500).

Example Input:

{
  "width": 1024,
  "height": 1024,
  "prompt": "TOK at a beach",
  "refine": "no_refiner",
  "loraScale": 0.6,
  "scheduler": "K_EULER",
  "guidanceScale": 7.5,
  "applyWatermark": true,
  "negativePrompt": "",
  "promptStrength": 0.8,
  "numberOfOutputs": 1,
  "highNoiseFraction": 0.8,
  "numberOfInferenceSteps": 50
}

Output

The action typically returns a URL pointing to the generated image. Here’s an example of the output:

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/bc125b53-07c2-493f-9e92-9fb0d79b53a9/7a50cdb7-6a2d-4904-beb5-b5c0416bd052.png"
]

Conceptual Usage Example (Python)

Below is a conceptual Python code snippet demonstrating how to invoke the "Generate Puppet Character Image with Inpainting" action using the Cognitive Actions API.

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 = "20daf136-ea56-47c1-ac72-a6c23f2e6012"  # Action ID for Generate Puppet Character Image with Inpainting

# Construct the input payload based on the action's requirements
payload = {
    "width": 1024,
    "height": 1024,
    "prompt": "TOK at a beach",
    "refine": "no_refiner",
    "loraScale": 0.6,
    "scheduler": "K_EULER",
    "guidanceScale": 7.5,
    "applyWatermark": True,
    "negativePrompt": "",
    "promptStrength": 0.8,
    "numberOfOutputs": 1,
    "highNoiseFraction": 0.8,
    "numberOfInferenceSteps": 50
}

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 for the API key and action ID. The payload is structured to match the example input requirements, and the request is sent to the hypothetical endpoint.

Conclusion

The lazymindz/sdxl-lora-flateric Cognitive Actions empower developers to create custom images effortlessly, enhancing applications with unique visuals. By leveraging the "Generate Puppet Character Image with Inpainting" action, you can easily craft personalized images that resonate with your projects. Consider exploring additional use cases like creating themed images or designing unique characters for games and applications. Happy coding!