Enhance Your App's Creativity: A Guide to the pielgrin/sdxl-omaji-sport Cognitive Actions

21 Apr 2025
Enhance Your App's Creativity: A Guide to the pielgrin/sdxl-omaji-sport Cognitive Actions

In today's rapidly evolving digital landscape, leveraging advanced image processing capabilities can significantly enhance the user experience of your applications. The pielgrin/sdxl-omaji-sport spec provides a powerful set of Cognitive Actions designed for image inpainting and generation. These pre-built actions allow developers to integrate sophisticated image manipulation features into their applications with ease, offering benefits such as enhanced output quality, customization, and creative control.

Prerequisites

Before you begin using the Cognitive Actions, ensure you have the following:

  • API Key: You will need an API key for accessing the Cognitive Actions platform. This key is essential for authentication when making API requests.
  • Generic Setup: Familiarity with making API calls in your preferred programming language, particularly how to structure JSON payloads and handle responses.

Authentication typically involves passing your API key in the request headers, ensuring secure access to the Cognitive Actions.

Cognitive Actions Overview

Generate Inpainted Image

The Generate Inpainted Image action allows you to perform sophisticated image inpainting and generation using a comprehensive prediction schema. With capabilities such as mask application and image refinement, this action ensures enhanced output quality and a high level of customization.

Input

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

  • mask (string, URI): URI of the input mask used in inpaint mode. Black areas remain unchanged, while white areas are inpainted.
  • seed (integer, optional): Integer value for a random seed. Leave blank to use a random seed.
  • image (string, URI): 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 guiding the image generation process.
  • refine (string, default: "no_refiner"): Select the style for image refinement (no_refiner, expert_ensemble_refiner, base_image_refiner).
  • scheduler (string, default: "K_EULER"): Algorithm used for scheduling the refinement steps.
  • customWeights (string, optional): Specify custom LoRA weights as a URI.
  • guidanceScale (number, default: 7.5): Determines the strength of classifier-free guidance, between 1 and 50.
  • loraIntensity (number, default: 0.6): Factor affecting LoRA model adjustments, ranging from 0 to 1.
  • applyWatermark (boolean, default: true): Specifies whether a watermark is applied to identify generated images.
  • negativePrompt (string, default: ""): Text specifying elements to exclude from the generated image.
  • promptStrength (number, default: 0.8): Controls the influence of the prompt in img2img or inpaint modes.
  • numberOfOutputs (integer, default: 1): The number of images to generate, ranging from 1 to 4.
  • refinementSteps (integer, optional): Specifies the refinement steps for the base_image_refiner.
  • highNoiseFraction (number, default: 0.8): Fraction of noise to introduce in expert_ensemble_refiner mode.
  • disableSafetyChecker (boolean, default: false): Option to deactivate the safety checker for generated images.
  • numberOfInferenceSteps (integer, default: 50): Defines the total number of denoising steps.

Example Input:

{
  "width": 1024,
  "height": 1024,
  "prompt": "A TOK emoji skydiver in the sky with white skin and dark hair",
  "refine": "no_refiner",
  "scheduler": "K_EULER",
  "guidanceScale": 7.5,
  "loraIntensity": 0.6,
  "applyWatermark": true,
  "negativePrompt": "no helmet",
  "promptStrength": 0.8,
  "numberOfOutputs": 3,
  "highNoiseFraction": 0.8,
  "numberOfInferenceSteps": 50
}

Output

The action typically returns an array of image URLs, which represent the generated images based on the input parameters.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/5c138a81-a99e-4366-be73-c9fb46fb3906/27959997-b9a6-4f23-a079-36ea7fde0e40.png",
  "https://assets.cognitiveactions.com/invocations/5c138a81-a99e-4366-be73-c9fb46fb3906/9dcd7d58-3734-4232-bae5-f20b6af5d100.png",
  "https://assets.cognitiveactions.com/invocations/5c138a81-a99e-4366-be73-c9fb46fb3906/2f2b626f-d17b-4030-8dae-85b38b4d6251.png"
]

Conceptual Usage Example (Python)

Here’s how you might call the Generate Inpainted 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 = "995039aa-842b-4ed4-9db8-6d51a1af6fb8"  # Action ID for Generate Inpainted Image

# Construct the input payload based on the action's requirements
payload = {
    "width": 1024,
    "height": 1024,
    "prompt": "A TOK emoji skydiver in the sky with white skin and dark hair",
    "refine": "no_refiner",
    "scheduler": "K_EULER",
    "guidanceScale": 7.5,
    "loraIntensity": 0.6,
    "applyWatermark": True,
    "negativePrompt": "no helmet",
    "promptStrength": 0.8,
    "numberOfOutputs": 3,
    "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 snippet, replace the placeholders with your actual API key and endpoint. The payload object is constructed based on the input schema of the action, ensuring that all required fields are included. The response will contain the generated images based on your specifications.

Conclusion

The Generate Inpainted Image action within the pielgrin/sdxl-omaji-sport spec provides a robust solution for developers looking to enhance their applications with advanced image processing capabilities. By integrating these Cognitive Actions, you can unlock a wide range of creative possibilities, from generating unique images to performing targeted inpainting. Explore these features further and consider how they can elevate your application's functionality!