Create Stunning Images with Abyssalsoul/Cyberdad Cognitive Actions

The Abyssalsoul/Cyberdad API provides powerful Cognitive Actions that enable developers to generate high-quality images through advanced inpainting and img2img techniques. These pre-built actions allow for fine-tuning of various parameters such as aspect ratio, resolution, and model selection, significantly reducing the complexity of image generation tasks. By leveraging these actions, developers can enhance their applications' visual content effortlessly.
Prerequisites
To utilize the Cognitive Actions in the Abyssalsoul/Cyberdad API, you will need:
- An API key to authenticate requests to the Cognitive Actions platform.
- Familiarity with making HTTP requests in your programming environment.
Authentication typically involves passing your API key in the request headers, ensuring secure access to the action endpoints.
Cognitive Actions Overview
Generate Image with Inpainting
The Generate Image with Inpainting action allows you to create detailed images using either img2img or inpainting modes. You can customize parameters such as aspect ratio, resolution, and model selection, optimizing for either quality or speed.
Input
The input schema for this action is defined as follows:
{
"prompt": "A detailed description guiding the image generation.",
"model": "dev",
"aspectRatio": "1:1",
"outputFormat": "png",
"guidanceScale": 3.5,
"mainLoraScale": 1,
"outputQuality": 80,
"numberOfOutputs": 4,
"additionalLoraScale": 0.8,
"numberOfInferenceSteps": 28
}
Example Input:
{
"model": "dev",
"prompt": "A photo of CYBERDAD award b&w portrait of a fit bald man with wearing dark well dressed polo and dark-rimmed glasses. He has a confident yet approachable reassuring expression. Decontracted pose, displaying pearl black bracelets and a wristwatch. Head slightly tilted to the right and hands off-center to the left. The lighting is soft, creating a clean and crisp image with a focus on the man's facial features and the details of his accessories. The background is neutral, further emphasizing the subject's relaxed yet stylish demeanor, looking down, 4k ",
"aspectRatio": "1:1",
"outputFormat": "png",
"guidanceScale": 3.5,
"mainLoraScale": 1,
"outputQuality": 80,
"numberOfOutputs": 4,
"additionalLoraScale": 0.8,
"numberOfInferenceSteps": 28
}
Output
The action typically returns an array of URLs pointing to the generated images. Below is an example of the expected output:
[
"https://assets.cognitiveactions.com/invocations/643b4121-78d5-41f8-b043-b2bfb4151c30/9a8a74f6-e9d5-43c6-a26b-c350796fe87f.png",
"https://assets.cognitiveactions.com/invocations/643b4121-78d5-41f8-b043-b2bfb4151c30/ea9e3099-8494-4e70-b447-3f5067b23d7c.png",
"https://assets.cognitiveactions.com/invocations/643b4121-78d5-41f8-b043-b2bfb4151c30/4517448f-4900-4cc3-aa79-606509847ba8.png",
"https://assets.cognitiveactions.com/invocations/643b4121-78d5-41f8-b043-b2bfb4151c30/a634c55c-693e-4816-b94f-31fe14cccf34.png"
]
Conceptual Usage Example (Python)
Here’s a conceptual example of how you might call the Generate Image with Inpainting 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 = "ac3a705c-2b21-43ea-ad5d-03f0844becd3" # Action ID for Generate Image with Inpainting
# Construct the input payload based on the action's requirements
payload = {
"model": "dev",
"prompt": "A photo of CYBERDAD award b&w portrait of a fit bald man with wearing dark well dressed polo and dark-rimmed glasses. He has a confident yet approachable reassuring expression. Decontracted pose, displaying pearl black bracelets and a wristwatch. Head slightly tilted to the right and hands off-center to the left. The lighting is soft, creating a clean and crisp image with a focus on the man's facial features and the details of his accessories. The background is neutral, further emphasizing the subject's relaxed yet stylish demeanor, looking down, 4k ",
"aspectRatio": "1:1",
"outputFormat": "png",
"guidanceScale": 3.5,
"mainLoraScale": 1,
"outputQuality": 80,
"numberOfOutputs": 4,
"additionalLoraScale": 0.8,
"numberOfInferenceSteps": 28
}
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, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The input payload is structured to match the requirements of the Generate Image with Inpainting action.
Conclusion
The Abyssalsoul/Cyberdad Cognitive Action for generating images with inpainting capabilities provides an intuitive way for developers to enrich their applications with high-quality visuals. By leveraging customizable parameters, you can tailor the output to meet specific needs, enhancing user engagement through stunning imagery. Consider exploring additional use cases or integrating this action into your existing applications to unlock new creative possibilities!