Create Stunning Visuals with Aisha AI's Detail-Realistic XL v7m2 Action

21 Apr 2025
Create Stunning Visuals with Aisha AI's Detail-Realistic XL v7m2 Action

In the realm of image generation, the Aisha AI Detail-Realistic XL v7m2 API offers powerful capabilities for developers looking to create high-quality, detailed images based on specific prompts. The Generate Realistic Images action allows you to customize various aspects of the image generation process, enabling a range of creative applications from art generation to content creation.

Prerequisites

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

  • An API key for the Aisha AI Cognitive Actions platform.
  • Familiarity with sending HTTP requests and handling JSON data.

Authentication typically involves passing your API key in the headers of your requests, allowing you to securely access the cognitive actions.

Cognitive Actions Overview

Generate Realistic Images

The Generate Realistic Images action utilizes the Detail-Realistic-XL-v7-mark2 model to produce high-quality images from the prompts you provide. This action is categorized under image generation, making it a versatile tool for visual content creation.

Input

The input schema for this action is defined as follows:

  • seed (integer): The seed used for generation. Set to -1 for a random seed.
    Example: -1
  • model (string): The model to be used. Defaults to 'Detail-Realistic-XL-v7-mark2'.
    Example: "Detail-Realistic-XL-v7-mark2"
  • steps (integer): Number of steps for generation. Range is 1 to 100.
    Example: 30
  • width (integer): The width of the generated image, in pixels (1 to 4096).
    Example: 1024
  • height (integer): The height of the generated image, in pixels (1 to 4096).
    Example: 1024
  • prompt (string): The prompt for generation using Compel weighting syntax.
    Example: "street, 1girl, dark-purple short hair, purple eyes, medium breasts, cleavage, casual clothes, smile, V"
  • pagScale (number): PAG scale, functioning similarly to CFG, improves the result. Set to 0 to disable.
    Example: 3
  • batchSize (integer): Number of images to generate simultaneously (1-4).
    Example: 1
  • scheduler (string): The scheduler for the generation process, defaults to 'DPM++ 2M'.
    Example: "DPM++ 2M"
  • clipLayerSkip (integer): The number of CLIP layers to skip.
    Example: 1
  • negativePrompt (string): Specifies elements to exclude using Compel weighting syntax.
    Example: "nsfw, naked"
  • guidanceRescale (number): Rescale amount for CFG-generated noise to avoid overexposure.
    Example: 0.5
  • prependPreprompt (boolean): Prepend a preprompt to enhance image quality.
    Example: true
  • configurationScale (number): CFG scale defines attention to the prompt.
    Example: 5
  • variationalAutoencoder (string): The Variational Autoencoder to use, defaults to 'default'.
    Example: "default"

Here’s how a complete input JSON payload might look:

{
    "seed": -1,
    "model": "Detail-Realistic-XL-v7-mark2",
    "steps": 30,
    "width": 1024,
    "height": 1024,
    "prompt": "street, 1girl, dark-purple short hair, purple eyes, medium breasts, cleavage, casual clothes, smile, V",
    "pagScale": 3,
    "batchSize": 1,
    "scheduler": "DPM++ 2M",
    "clipLayerSkip": 1,
    "negativePrompt": "nsfw, naked",
    "guidanceRescale": 0.5,
    "prependPreprompt": true,
    "configurationScale": 5,
    "variationalAutoencoder": "default"
}

Output

The action typically returns a URL linking to the generated image. For example:

[
    "https://assets.cognitiveactions.com/invocations/aa2634ce-acb8-49a0-b6a6-6f8655e16bf6/cba694bf-f11e-426d-9b4a-30b5ec931396.png"
]

Conceptual Usage Example (Python)

Below is a conceptual Python code snippet demonstrating how to call the Generate Realistic 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 = "70e7aca6-7d68-494b-b9e3-f13b6cb0fedf"  # Action ID for Generate Realistic Images

# Construct the input payload based on the action's requirements
payload = {
    "seed": -1,
    "model": "Detail-Realistic-XL-v7-mark2",
    "steps": 30,
    "width": 1024,
    "height": 1024,
    "prompt": "street, 1girl, dark-purple short hair, purple eyes, medium breasts, cleavage, casual clothes, smile, V",
    "pagScale": 3,
    "batchSize": 1,
    "scheduler": "DPM++ 2M",
    "clipLayerSkip": 1,
    "negativePrompt": "nsfw, naked",
    "guidanceRescale": 0.5,
    "prependPreprompt": true,
    "configurationScale": 5,
    "variationalAutoencoder": "default"
}

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, we replace the placeholder for the API key and endpoint URL with your actual values. The action_id corresponds to the Generate Realistic Images action, and the payload is structured according to the input schema.

Conclusion

The Aisha AI's Generate Realistic Images action provides developers with an accessible means to create stunning, detailed visuals tailored to specific prompts and parameters. By leveraging its capabilities, you can enhance your applications with high-quality images, making them more engaging and visually appealing. As you explore these Cognitive Actions, consider how they can fit into your projects and elevate your creative endeavors.