Elevate Your Image Creation with the pagebrain/absolutereality-v1-6 Cognitive Actions

21 Apr 2025
Elevate Your Image Creation with the pagebrain/absolutereality-v1-6 Cognitive Actions

The pagebrain/absolutereality-v1-6 API offers a powerful set of Cognitive Actions designed to enhance image generation capabilities. By leveraging advanced models with optimized resources, developers can create high-quality images with various transformations and customizations. This article will guide you through the Generate Enhanced Images action, detailing its features, input requirements, output expectations, and providing a conceptual example for integration into your applications.

Prerequisites

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

  • An API key for accessing the Cognitive Actions platform.
  • Basic knowledge of JSON and RESTful API interactions.
  • The ability to send HTTP requests from your development environment.

Authentication is typically handled by including your API key within the request headers as a Bearer token.

Cognitive Actions Overview

Generate Enhanced Images

The Generate Enhanced Images action utilizes the AbsoluteReality-v1-6 model to create high-quality images through techniques such as negative embeddings, img2img transformation, and inpainting. This action is particularly useful for developers looking to generate images with specific attributes while applying safety checks and optimizations for better performance.

Input

The input schema for this action requires the following fields:

  • mask (string, optional): Input mask for inpaint mode; black areas will be preserved, while white areas will be inpainted.
  • seed (integer, optional): Random seed. Leave blank to randomize.
  • image (string, optional): Input image for img2img or inpaint mode.
  • width (integer, default: 512): Specifies the output image width (options range from 128 to 1024).
  • height (integer, default: 512): Specifies the output image height (options range from 128 to 1024).
  • prompt (string, required): Input prompt to guide image generation.
  • scheduler (string, default: "K_EULER"): Algorithm for scheduling the diffusion process.
  • guidanceScale (number, default: 7.5): Adjusts the influence of the classifier-free guidance (valid range: 1 to 20).
  • safetyChecker (boolean, default: true): Enables or disables the safety checker to filter output content.
  • negativePrompt (string, optional): Defines elements to avoid in the output image.
  • promptStrength (number, default: 0.8): Strength of the prompt influence when using an initial image.
  • numberOfOutputs (integer, default: 1): Number of output images to generate (range: 1 to 4).
  • numberOfInferenceSteps (integer, default: 50): Number of denoising steps during inference (range: 1 to 500).

Example Input:

{
  "seed": 27128,
  "width": 576,
  "height": 1024,
  "prompt": "close up Portrait photo of muscular bearded guy in a worn mech suit, ((light bokeh)), intricate, (steel metal [rust]), elegant, sharp focus, photo by greg rutkowski, soft lighting, vibrant colors, masterpiece, ((streets)), detailed face",
  "scheduler": "K_EULER_ANCESTRAL",
  "guidanceScale": 5,
  "safetyChecker": true,
  "negativePrompt": "(worst quality:2),(low quality:2),(blurry:2),bad_prompt,text, (bad and mutated hands:1.3),(bad hands),badhandv4,mutated hands, bad anatomy, missing fingers,extra fingers,fused fingers,too many fingers,(interlocked fingers:1.2), extra limbs,malformed limbs,multiple limbs, extra arms, extra legs, long neck, cross-eyed, negative_hand, negative_hand-neg, text, label, caption, nude, nsfw, naked, explicit, porn",
  "promptStrength": 0.8,
  "numberOfOutputs": 1,
  "numberOfInferenceSteps": 30
}

Output

The output of this action typically returns an array of URLs pointing to the generated images. Here’s an example of what you might receive:

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/f7c1c8de-8609-4aaf-a3b1-ab9f361aceb8/c410c866-5ec5-4e99-ac04-c8e6c8230e47.png"
]

Conceptual Usage Example (Python)

Here’s a conceptual Python code snippet demonstrating how you might call the Generate Enhanced Images action:

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 = "889156ed-106e-43d6-8fe7-3d7c81581784"  # Action ID for Generate Enhanced Images

# Construct the input payload based on the action's requirements
payload = {
    "seed": 27128,
    "width": 576,
    "height": 1024,
    "prompt": "close up Portrait photo of muscular bearded guy in a worn mech suit, ((light bokeh)), intricate, (steel metal [rust]), elegant, sharp focus, photo by greg rutkowski, soft lighting, vibrant colors, masterpiece, ((streets)), detailed face",
    "scheduler": "K_EULER_ANCESTRAL",
    "guidanceScale": 5,
    "safetyChecker": true,
    "negativePrompt": "(worst quality:2),(low quality:2),(blurry:2),bad_prompt,text, (bad and mutated hands:1.3),(bad hands),badhandv4,mutated hands, bad anatomy, missing fingers,extra fingers,fused fingers,too many fingers,(interlocked fingers:1.2), extra limbs,malformed limbs,multiple limbs, extra arms, extra legs, long neck, cross-eyed, negative_hand, negative_hand-neg, text, label, caption, nude, nsfw, naked, explicit, porn",
    "promptStrength": 0.8,
    "numberOfOutputs": 1,
    "numberOfInferenceSteps": 30
}

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, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action ID is set for Generate Enhanced Images, and the input payload is structured according to the action's requirements. The endpoint URL and request structure are illustrative.

Conclusion

The Generate Enhanced Images action from the pagebrain/absolutereality-v1-6 API empowers developers to create stunning images tailored to specific prompts and requirements. With features like inpainting, safety checks, and customizable parameters, integrating this action can significantly enhance your application's image generation capabilities. Explore further use cases and experiment with different input configurations to fully leverage the power of Cognitive Actions in your projects!