Generate Stunning Images with the aisha-ai-official/coolname-il-v1 Cognitive Actions

In the world of artificial intelligence and machine learning, image generation has become an exciting frontier for developers. The aisha-ai-official/coolname-il-v1 spec provides a powerful set of Cognitive Actions aimed at high-quality image generation, particularly through the use of the CyberRealisticPony model. This platform allows developers to create visually stunning images based on textual prompts while providing numerous customizable parameters. Let's dive into how to leverage these Cognitive Actions effectively.
Prerequisites
Before you start using the Cognitive Actions, ensure you have the following:
- API Key: You need an API key to authenticate requests to the Cognitive Actions platform. This key should be included in the headers of your HTTP requests.
- Basic Knowledge of JSON: Understanding JSON structure will help you construct requests and interpret responses.
Authentication typically involves passing the API key in the request headers as follows:
Authorization: Bearer YOUR_COGNITIVE_ACTIONS_API_KEY
Cognitive Actions Overview
Generate Image Using CyberRealisticPony
The Generate Image Using CyberRealisticPony action allows you to create high-quality images driven by a textual prompt. It offers extensive customization options, such as image dimensions, prompt specifics, and various generation parameters.
Input
The input for this action is a composite request object that includes the following fields:
- seed (integer): A seed for random number generation. Default is -1, which uses a random seed.
- model (string): The model to use, which is set to "CyberRealisticPony".
- steps (integer): The number of steps for image generation, ranging from 1 to 100. Default is 30.
- width (integer): The output image width in pixels (1 to 4096). Default is 1024.
- height (integer): The output image height in pixels (1 to 4096). Default is 1024.
- prompt (string): Descriptive text that guides image generation.
- clipSkip (integer): Number of CLIP layers to skip, default is 2.
- batchSize (integer): Number of images to generate in one request (1 to 4). Default is 1.
- pageScale (number): Adjusts output quality, valid range is 0 to 50.
- scheduler (string): The scheduling algorithm for generation, default is "Euler a".
- configScale (number): Controls model focus on the prompt, valid range is 1 to 50.
- prependPrompt (boolean): Whether to prepend a predefined prompt to enhance quality, default is true.
- negativePrompt (string): Specifies unwanted elements in the image.
- guidanceRescale (number): Scales CFG-generated noise, valid range is 0 to 5.
- useFaceDetectorYoloV9c (boolean): Enables face detection, default is true.
- useHandDetectorYoloV9c (boolean): Enables hand detection, default is false.
- variationalAutoencoder (string): Specifies the VAE to use, default is "default".
- usePersonSegmenterYoloV8m (boolean): Enables person segmentation, default is false.
Here’s an example of the input JSON payload:
{
"seed": -1,
"model": "CyberRealisticPony",
"steps": 30,
"width": 1024,
"height": 1024,
"prompt": "street, 1girl, dark-purple short hair, purple eyes, medium breasts, cleavage, casual clothes, smile, V",
"clipSkip": 2,
"batchSize": 1,
"pageScale": 0,
"scheduler": "Euler a",
"configScale": 7,
"prependPrompt": true,
"negativePrompt": "nsfw, naked",
"guidanceRescale": 1,
"useFaceDetectorYoloV9c": true,
"useHandDetectorYoloV9c": false,
"variationalAutoencoder": "default",
"usePersonSegmenterYoloV8m": false
}
Output
Upon successful execution, the action returns a URL to the generated image. Here’s an example of what you might receive:
[
"https://assets.cognitiveactions.com/invocations/7ff9b17d-62b1-4f89-8804-573b823385e5/4ed1a6ef-aa16-4a68-aea1-dd41b22ba01f.png"
]
Conceptual Usage Example (Python)
Here’s a conceptual Python snippet for executing the Generate Image Using CyberRealisticPony 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 = "604e0696-4c5f-40ad-957a-f9513560859b" # Action ID for Generate Image Using CyberRealisticPony
# Construct the input payload based on the action's requirements
payload = {
"seed": -1,
"model": "CyberRealisticPony",
"steps": 30,
"width": 1024,
"height": 1024,
"prompt": "street, 1girl, dark-purple short hair, purple eyes, medium breasts, cleavage, casual clothes, smile, V",
"clipSkip": 2,
"batchSize": 1,
"pageScale": 0,
"scheduler": "Euler a",
"configScale": 7,
"prependPrompt": True,
"negativePrompt": "nsfw, naked",
"guidanceRescale": 1,
"useFaceDetectorYoloV9c": True,
"useHandDetectorYoloV9c": False,
"variationalAutoencoder": "default",
"usePersonSegmenterYoloV8m": False
}
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 for generating images using the CyberRealisticPony model. The input payload is structured to match the action’s requirements, and the result will provide you with the URL of the generated image.
Conclusion
The aisha-ai-official/coolname-il-v1 Cognitive Actions open up exciting possibilities for developers looking to integrate image generation into their applications. By using the Generate Image Using CyberRealisticPony action, you can harness the power of AI to create stunning visuals based on textual descriptions.
Explore various customization parameters to tailor the output to your specific needs, and start enhancing your applications with high-quality imagery today!