Create Stunning Composite Images with Aisha AI's CoolName-IL-v2 Actions

In the world of digital content creation, the ability to generate high-quality images can significantly enhance the user experience. The Aisha AI's CoolName-IL-v2 offers powerful Cognitive Actions to help developers integrate sophisticated image generation capabilities into their applications. With the Generate Composite Image action, you can create detailed composite images by specifying various parameters, allowing for a high degree of customization.
Prerequisites
Before you start using the Cognitive Actions, ensure that you have the following:
- An API key for the Cognitive Actions platform.
- Basic knowledge of JSON and HTTP requests.
- A development environment set up for making API calls, such as Python with the
requestslibrary.
Authentication typically involves passing your API key in the request headers to authenticate your calls.
Cognitive Actions Overview
Generate Composite Image
The Generate Composite Image action allows you to create high-quality composite images by providing specific dimensions, prompts, and other parameters. This action is categorized under image-generation and provides extensive control over the image features, including details about faces, hands, and people.
Input
The input for this action is structured as a JSON object, defined by the following schema:
{
"vae": "default",
"seed": -1,
"model": "CoolName-IL-v2",
"steps": 30,
"width": 1280,
"height": 1280,
"prompt": "street, 1girl, dark-purple short hair, purple eyes, medium breasts, cleavage, casual clothes, smile, V",
"upscale": "Original",
"cfgScale": 7,
"clipSkip": 2,
"pagScale": 0,
"batchSize": 1,
"scheduler": "Euler a",
"detailerFace": false,
"detailerHand": false,
"detailerPerson": false,
"negativePrompt": "nsfw, naked",
"guidanceRescale": 1,
"prependPreprompt": true
}
Key fields include:
- vae: Specifies the Variational Autoencoder to use (default is “default”).
- seed: Determines the seed for generation; -1 selects a random seed.
- model: Defines the model used for generation (fixed to "CoolName-IL-v2").
- steps: Sets the number of steps for generating the image (default is 30; max 100).
- width and height: Dimensions of the output image (1-4096 pixels).
- prompt: Descriptive text guiding image generation.
- negativePrompt: Elements to exclude using negative prompt syntax.
Output
Upon successful execution, the action typically returns a JSON array containing URLs to the generated images. Here’s an example output:
[
"https://assets.cognitiveactions.com/invocations/d318f480-b0cb-472c-9404-9c34860e1a24/79bde820-6a79-4360-badf-00aff07f5e40.png"
]
Conceptual Usage Example (Python)
Here’s a conceptual Python code snippet illustrating how to invoke the Generate Composite Image 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 = "fcbcc77d-c174-4056-bbb6-91ef72caf5d7" # Action ID for Generate Composite Image
# Construct the input payload based on the action's requirements
payload = {
"vae": "default",
"seed": -1,
"model": "CoolName-IL-v2",
"steps": 30,
"width": 1280,
"height": 1280,
"prompt": "street, 1girl, dark-purple short hair, purple eyes, medium breasts, cleavage, casual clothes, smile, V",
"upscale": "Original",
"cfgScale": 7,
"clipSkip": 2,
"pagScale": 0,
"batchSize": 1,
"scheduler": "Euler a",
"detailerFace": false,
"detailerHand": false,
"detailerPerson": false,
"negativePrompt": "nsfw, naked",
"guidanceRescale": 1,
"prependPreprompt": true
}
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, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action ID is set to the specific action you want to execute. The input payload is structured according to the action's requirements, and the code handles HTTP responses and potential errors gracefully.
Conclusion
The Generate Composite Image action from Aisha AI's CoolName-IL-v2 provides a robust solution for developers looking to integrate high-quality image generation into their applications. With extensive customization options, you can create unique and visually appealing content tailored to your needs. Explore the capabilities of this action and consider experimenting with different prompts and configurations to unlock its full potential!