Generate Stunning Custom Images with jiownt/atomaus Cognitive Actions

In today's digital landscape, the ability to create custom visuals quickly and efficiently can significantly enhance applications across various domains. The jiownt/atomaus spec provides a powerful set of Cognitive Actions designed for image generation, particularly through inpainting and image-to-image transformations. With these pre-built actions, developers can easily integrate advanced image generation capabilities into their applications, opening up a world of creative possibilities.
Prerequisites
To utilize the Cognitive Actions in the jiownt/atomaus spec, you need to have an API key for the Cognitive Actions platform. Authentication typically involves passing this API key in the request headers to authorize your access to the actions.
Cognitive Actions Overview
Generate Custom Image with Inpainting
Purpose: This action allows you to generate custom images using inpainting or image-to-image transformations. It offers two models: dev for detailed outputs and schnell for faster results. This flexibility, combined with customizable parameters such as image dimensions and quality settings, makes it a versatile tool for developers.
Category: Image Generation
Input: The input for this action is structured as follows:
- prompt (required): A detailed text description of the image you want to generate.
- model (optional): Inference model selection. Can be "dev" (detailed) or "schnell" (fast).
- image (optional): URI of the input image for transformation.
- mask (optional): URI of the image mask for inpainting.
- width (optional): Width of the generated image.
- height (optional): Height of the generated image.
- seed (optional): Seed value for reproducibility.
- guidanceScale (optional): Scale for the diffusion process.
- outputQuality (optional): Quality level for the output image.
- numberOfOutputs (optional): How many images to generate.
- imageAspectRatio (optional): Defines the aspect ratio for the image.
- imageOutputFormat (optional): Format of the output images.
Here’s an example input JSON payload:
{
"model": "dev",
"prompt": "\"A hyper-realistic digital illustration of ATOMAUS in a Grand Theft Auto V-inspired setting...\"",
"guidanceScale": 3,
"outputQuality": 80,
"numberOfOutputs": 4,
"imageAspectRatio": "1:1",
"imageOutputFormat": "webp"
}
Output: When executed, the action returns an array of URLs pointing to the generated images. Here’s an example of the output:
[
"https://assets.cognitiveactions.com/invocations/6b99d5e0-0b9d-4edf-920b-51ab1af583c4/4be3c52d-c169-44c7-addc-5b823fc49718.webp",
"https://assets.cognitiveactions.com/invocations/6b99d5e0-0b9d-4edf-920b-51ab1af583c4/6b4d8135-814f-4d89-9ca9-82a5481dff65.webp",
"https://assets.cognitiveactions.com/invocations/6b99d5e0-0b9d-4edf-920b-51ab1af583c4/e3ac0ae3-6372-419d-b259-5fae3ed64db9.webp",
"https://assets.cognitiveactions.com/invocations/6b99d5e0-0b9d-4edf-920b-51ab1af583c4/bd423f29-87fe-4c43-99e4-0875d0f6139e.webp"
]
Conceptual Usage Example (Python): Here’s how you might call this action using Python. Remember to replace placeholders with actual values:
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 = "c996405c-1745-433f-9c47-3c0beef0dc06" # Action ID for Generate Custom Image with Inpainting
# Construct the input payload based on the action's requirements
payload = {
"model": "dev",
"prompt": "\"A hyper-realistic digital illustration of ATOMAUS in a Grand Theft Auto V-inspired setting...\"",
"guidanceScale": 3,
"outputQuality": 80,
"numberOfOutputs": 4,
"imageAspectRatio": "1:1",
"imageOutputFormat": "webp"
}
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:
- You specify the action ID for "Generate Custom Image with Inpainting".
- A JSON payload is created based on the required input fields.
- The request is sent to a hypothetical Cognitive Actions endpoint.
Conclusion
The jiownt/atomaus Cognitive Actions provide a robust solution for generating custom images through advanced techniques like inpainting and image transformations. By leveraging these powerful capabilities, developers can easily enhance their applications and deliver stunning visuals to users. Explore the various parameters to fine-tune your image outputs, and consider integrating these actions into your projects for an elevated user experience. Happy coding!