Harnessing the Power of Image Generation with asiryan/deliberate-v3 Cognitive Actions

The asiryan/deliberate-v3 API unlocks the potential of advanced image generation through a versatile set of Cognitive Actions. These actions allow developers to create images using various modes, including Text-to-Image, Image-to-Image, and Inpainting. By leveraging pre-built functionalities, developers can save time and enhance the quality of image outputs in their applications.
In this article, we'll explore the key Cognitive Action available in the asiryan/deliberate-v3 API and how to effectively integrate it into your projects.
Prerequisites
Before diving into the integration of Cognitive Actions, ensure you have the following:
- An API key for the Cognitive Actions platform.
- Basic knowledge of JSON and HTTP requests.
- Familiarity with Python for executing the example code.
For authentication, you'll typically pass your API key in the headers of your requests to the Cognitive Actions endpoint.
Cognitive Actions Overview
Generate Deliberate V3 Image
The Generate Deliberate V3 Image action utilizes the Deliberate V3 Model to generate images based on user-defined prompts and configurations. This action is designed for developers looking to create unique visual content with precise control over the output.
Input
The input for this action is structured as follows:
{
"width": 512,
"height": 728,
"prompt": "mj, ny, cinematic",
"strength": 1,
"scheduler": "K_EULER_ANCESTRAL",
"guidanceScale": 7.5,
"negativePrompt": "[deformed | disfigured], poorly drawn, [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, (mutated hands and fingers), blurry",
"useKarrasSigmas": false,
"numInferenceSteps": 20
}
- width (integer): Output image width in pixels. Range from 0 to 1920 (default 512).
- height (integer): Output image height in pixels. Range from 0 to 1920 (default 728).
- prompt (string): Text prompt guiding image generation (default: "mj, ny, cinematic").
- strength (number): Degree of adherence to the input image (0 to 1, default 1).
- scheduler (string): Scheduler type used during image generation (default: "K_EULER_ANCESTRAL").
- guidanceScale (number): Controls adherence to the prompt (0 to 10, default 7.5).
- negativePrompt (string): Negative text prompts to avoid during generation (default: a set of undesirable traits).
- useKarrasSigmas (boolean): Whether to use Karras sigmas (default false).
- numInferenceSteps (integer): Total number of inference steps for generating the image (0 to 100, default 20).
Output
The action typically returns a URL pointing to the generated image. For example:
https://assets.cognitiveactions.com/invocations/a7cb1811-08ca-4dfd-baa7-b716a0ee05cb/054542db-07c8-4d33-81c1-716e0340477a.png
Conceptual Usage Example (Python)
Here’s how a developer might call this 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 = "7b0ee7fa-eb9f-472d-968a-a914d2aa95a7" # Action ID for Generate Deliberate V3 Image
# Construct the input payload based on the action's requirements
payload = {
"width": 512,
"height": 728,
"prompt": "mj, ny, cinematic",
"strength": 1,
"scheduler": "K_EULER_ANCESTRAL",
"guidanceScale": 7.5,
"negativePrompt": "[deformed | disfigured], poorly drawn, [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, (mutated hands and fingers), blurry",
"useKarrasSigmas": False,
"numInferenceSteps": 20
}
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 input payload is structured according to the action's requirements. The endpoint URL and request structure are illustrative, focusing on the action ID and payload.
Conclusion
The asiryan/deliberate-v3 Cognitive Actions offer a powerful way to generate images tailored to your specifications. By utilizing the capabilities of the Generate Deliberate V3 Image action, you can enhance your applications with unique visual content, taking advantage of advanced image generation techniques. Explore these actions further and start integrating them into your projects today!