Create Stunning 3D Images with the jordancoult/sdxl-crossview Cognitive Actions

23 Apr 2025
Create Stunning 3D Images with the jordancoult/sdxl-crossview Cognitive Actions

The jordancoult/sdxl-crossview Cognitive Actions provide developers with powerful tools to generate 3D crossview images from input images and masks. This suite of actions allows for advanced image generation techniques such as img2img processing, inpainting, and the application of various refinement methods to enhance image quality. By leveraging these pre-built actions, developers can seamlessly integrate sophisticated image generation capabilities into their applications.

Prerequisites

Before getting started with the Cognitive Actions, ensure you have the following:

  • API Key: You’ll need an API key to authenticate your requests to the Cognitive Actions platform. This key should be included in the headers of your API calls.
  • Environment Setup: Make sure you have an environment set up with access to the necessary libraries for making HTTP requests, such as requests for Python.

Conceptually, authentication can be handled by including your API key in the request headers, typically formatted as:

Authorization: Bearer YOUR_API_KEY

Cognitive Actions Overview

Generate Crossview Image

Purpose: The "Generate Crossview Image" action allows you to create 3D crossview images using specified input images and masks. It supports inpainting and img2img processing, along with various tuning options for enhanced image quality.

Category: Image Generation

Input: Below is a detailed breakdown of the required and optional fields in the request schema:

  • mask (string, optional): URI of the input mask for inpainting mode. Black areas are preserved, white areas are inpainted.
  • seed (integer, optional): Random seed for deterministic outputs. Default is random.
  • image (string, required): URI of the input image for img2img or inpaint mode.
  • width (integer, optional): Width of the output image in pixels. Default is 1024.
  • height (integer, optional): Height of the output image in pixels. Default is 1024.
  • prompt (string, optional): Input text prompt to guide image generation. Defaults to "An astronaut riding a rainbow unicorn."
  • outputCount (integer, optional): Number of images to generate (1 to 4). Default is 1.
  • guidanceScale (number, optional): Affects the influence of the prompt (1 to 50). Default is 7.5.
  • applyWatermark (boolean, optional): Enable or disable watermarking in images. Default is true.
  • negativeInputPrompt (string, optional): Text prompt for features to avoid. Default is empty.
  • Additional optional parameters include refine, loraScale, scheduler, promptStrength, and others.

Example Input:

{
  "seed": 1001,
  "width": 1024,
  "height": 1024,
  "prompt": "TOK crossview photo of a woman in a house. Cross eye 3D photo. Two images, split down the middle. Perspect, depth, 3D",
  "refine": "no_refiner",
  "loraScale": 0.6,
  "scheduler": "K_EULER",
  "outputCount": 1,
  "guidanceScale": 7.5,
  "applyWatermark": true,
  "promptStrength": 0.8,
  "highNoiseFraction": 0.8,
  "inferenceStepCount": 50,
  "negativeInputPrompt": "low quality, fake, 2D"
}

Output: The action typically returns a URL pointing to the generated image, such as:

[
  "https://assets.cognitiveactions.com/invocations/cc5ddb93-b092-48d6-8c00-5bd95d0c2d61/2c5029f4-87a0-4310-b761-76e56809defe.png"
]

Conceptual Usage Example (Python)

Here's how a developer might structure a call to the "Generate Crossview 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 = "b1a6f218-770f-49c8-8c73-dc4027a73ba7" # Action ID for Generate Crossview Image

# Construct the input payload based on the action's requirements
payload = {
    "seed": 1001,
    "width": 1024,
    "height": 1024,
    "prompt": "TOK crossview photo of a woman in a house. Cross eye 3D photo. Two images, split down the middle. Perspect, depth, 3D",
    "refine": "no_refiner",
    "loraScale": 0.6,
    "scheduler": "K_EULER",
    "outputCount": 1,
    "guidanceScale": 7.5,
    "applyWatermark": true,
    "promptStrength": 0.8,
    "highNoiseFraction": 0.8,
    "inferenceStepCount": 50,
    "negativeInputPrompt": "low quality, fake, 2D"
}

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}
    )
    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 COGNITIVE_ACTIONS_API_KEY and COGNITIVE_ACTIONS_EXECUTE_URL with your actual API key and endpoint. The action ID and input payload are structured according to the requirements outlined above.

Conclusion

The jordancoult/sdxl-crossview Cognitive Actions provide an excellent opportunity for developers to integrate advanced image generation capabilities into their applications. By leveraging the "Generate Crossview Image" action, you can create stunning 3D images with customizable features and refinements. Explore these actions further to discover how they can enhance your projects and improve user engagement!