Create Stunning Courtroom Art with the leonmak/sdxl-court Cognitive Actions

24 Apr 2025
Create Stunning Courtroom Art with the leonmak/sdxl-court Cognitive Actions

The leonmak/sdxl-court Cognitive Actions offer developers a powerful toolkit for generating courtroom sketch-style images using advanced LoRa techniques. Inspired by the artistry of courtroom painter Jane Rosenberg, these actions allow for personalized artistic expression in a structured and accessible manner. In this article, we'll explore how to integrate these actions into your applications, enabling you to create unique visual content effortlessly.

Prerequisites

To get started with the leonmak/sdxl-court Cognitive Actions, you'll need:

  • API Key: A valid API key to authenticate your requests to the Cognitive Actions platform.
  • Internet Access: Ensure your application can make HTTP requests to the Cognitive Actions API.

Authentication is generally handled by passing your API key in the request headers, allowing you to access the functionalities of the Cognitive Actions securely.

Cognitive Actions Overview

Generate Courtroom Sketch Images

Description: This action allows you to create courtroom sketch-style images using LoRa techniques, providing a unique artistic flair to your visual content.

Category: Image Generation

Input

The input schema for this action includes various customizable fields, allowing for flexibility in generating images:

  • seed (optional): Random seed for consistent outputs; leave blank to randomize.
  • width: Width of the output image in pixels (default: 1024).
  • height: Height of the output image in pixels (default: 1024).
  • prompt: Main description of the desired image content.
  • loraScale: LoRA additive scale (default: 0.6; max: 1, min: 0).
  • maskImage: URI of an input mask for inpaint mode.
  • inputImage: URI of an input image for img2img or inpaint mode.
  • loraWeights: LoRA weights to use; leave blank for defaults.
  • guidanceScale: Scale for classifier-free guidance (default: 7.5; max: 50, min: 1).
  • applyWatermark: Boolean for applying a watermark (default: true).
  • negativePrompt: Input prompt for excluding elements (default: empty).
  • promptStrength: Strength of the prompt (default: 0.8; max: 1, min: 0).
  • numberOfOutputs: Specifies the number of images to generate (default: 1; max: 4).
  • refinementSteps: Number of refinement steps for the base image.
  • refinementMethod: Selects the refinement style (default: no_refiner).
  • schedulingMethod: Algorithm for the image generation process (default: K_EULER).
  • highNoiseFraction: Fraction of noise used in refinement (default: 0.8).
  • numInferenceSteps: Total denoising steps (default: 50; max: 500, min: 1).
  • disableSafetyChecker: Option to disable the safety checker (default: false).

Example Input:

{
  "width": 1024,
  "height": 1024,
  "prompt": "lawyer pointing to chart of stock price going to bottom while talking to witness, a photo of courtroom",
  "loraScale": 0.87,
  "guidanceScale": 7.5,
  "applyWatermark": true,
  "negativePrompt": "",
  "promptStrength": 0.8,
  "numberOfOutputs": 1,
  "refinementMethod": "no_refiner",
  "schedulingMethod": "K_EULER",
  "highNoiseFraction": 0.8,
  "numInferenceSteps": 50
}

Output

The output of this action typically returns a list of URLs to the generated images. Here’s an example of a successful output:

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/859084e4-dce5-4c24-95e1-2383ed129e64/1a840bd7-67cf-4bd0-880b-f7e74eadd08b.png"
]

Conceptual Usage Example (Python)

Here’s a conceptual Python code snippet demonstrating how you could call this action using a hypothetical Cognitive Actions execution endpoint:

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 = "41b36cea-189b-4ff7-91fa-04edafef8723"  # Action ID for Generate Courtroom Sketch Images

# Construct the input payload based on the action's requirements
payload = {
    "width": 1024,
    "height": 1024,
    "prompt": "lawyer pointing to chart of stock price going to bottom while talking to witness, a photo of courtroom",
    "loraScale": 0.87,
    "guidanceScale": 7.5,
    "applyWatermark": True,
    "negativePrompt": "",
    "promptStrength": 0.8,
    "numberOfOutputs": 1,
    "refinementMethod": "no_refiner",
    "schedulingMethod": "K_EULER",
    "highNoiseFraction": 0.8,
    "numInferenceSteps": 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, you replace the YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The payload variable is structured to match the input schema, and the request is sent to the hypothetical execution endpoint.

Conclusion

The leonmak/sdxl-court Cognitive Actions empower developers to create unique courtroom sketches with ease. By integrating these actions into your applications, you can enhance user experiences with personalized artistic content. Explore the various parameters available to tailor your image generation process and consider how these actions can be utilized in your projects. Happy coding!