Generate Stunning Image Variations with the Whiteclaw DB Cognitive Actions

In the realm of image generation, the suryakantk94/whiteclaw-db Cognitive Actions provide an innovative way to create customized image variations. This set of actions allows developers to harness advanced image processing techniques, enabling them to generate multiple images from a single input using guided prompts and configurable parameters. Whether it's for creating unique visuals for applications, marketing materials, or artistic endeavors, these Cognitive Actions streamline the process and enhance creativity.
Prerequisites
Before diving into the image generation capabilities of the Cognitive Actions, you will need a few things in place:
- API Key: You must obtain an API key from the Cognitive Actions platform to authenticate your requests.
- Setup: Familiarize yourself with how to send HTTP requests, as you'll be sending your API key in the headers of your requests.
Authentication Overview
When making requests to the Cognitive Actions API, you will typically include your API key in the headers. This will authorize your application to access the actions available within the platform.
Cognitive Actions Overview
Generate Image Variations
The Generate Image Variations action allows you to create variations of a provided image based on detailed prompts and adjustable parameters like width, height, and scheduler. It supports the generation of up to four outputs per request, giving developers the flexibility to explore various creative outcomes.
Input
The input for this action requires a JSON object structured according to the following schema:
{
"seed": 1234,
"image": "http://example.com/image.png",
"width": 512,
"height": 512,
"prompt": "a photo of a person sitting with a TOK can in his hands in a football stadium. there is a display of different flavors of can in the bottom right side of the picture.",
"scheduler": "DDIM",
"guidanceScale": 7.5,
"negativePrompt": "blurry",
"promptStrength": 0.8,
"numberOfOutputs": 1,
"disableSafetyCheck": false,
"numberOfInferenceSteps": 50
}
Key Input Fields:
- seed (optional): An integer for reproducible results. If left blank, it randomizes the outcome.
- image (required): A URI to the starting image for generating variations.
- width (optional): Output image width (default 512).
- height (optional): Output image height (default 512).
- prompt (required): Text guiding the image generation (default is "a photo of cjw").
- scheduler (optional): Defines the scheduler for the denoising process (default is "DDIM").
- guidanceScale (optional): A scale factor influencing adherence to the prompt (default 7.5).
- negativePrompt (optional): Elements to avoid in the output image.
- promptStrength (optional): Prioritizes the influence of the initial image (default 0.8).
- numberOfOutputs (optional): Number of images to generate (from 1 to 4, default is 1).
- disableSafetyCheck (optional): Control to toggle the safety check system (default is false).
- numberOfInferenceSteps (optional): Total denoising steps (from 1 to 500, default is 50).
Output
Upon successful execution, the action returns an array of image URLs. For example:
[
"https://assets.cognitiveactions.com/invocations/aca78dbf-b724-4730-a4a6-8e7fc9c2963b/0f5e17d0-4145-435d-ba0e-be9ba548973d.png"
]
This output provides direct links to the generated images based on the input parameters.
Conceptual Usage Example (Python)
Here's a conceptual Python code snippet demonstrating how to call the Generate Image Variations 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 = "b2958208-3e8f-4134-b352-0c7d27574e0c" # Action ID for Generate Image Variations
# Construct the input payload based on the action's requirements
payload = {
"width": 512,
"height": 512,
"prompt": "a photo of a person sitting with a TOK can in his hands in a football stadium. there is a display of different flavors of can in the bottom right side of the picture.",
"scheduler": "DDIM",
"guidanceScale": 7.5,
"promptStrength": 0.8,
"numberOfOutputs": 1,
"disableSafetyCheck": False,
"numberOfInferenceSteps": 50
}
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}")
This code snippet illustrates how to structure the input JSON payload correctly and how to handle the API response. The endpoint URL and request structure shown here are for illustrative purposes and may vary based on actual implementation details.
Conclusion
The Generate Image Variations action from the suryakantk94/whiteclaw-db Cognitive Actions empowers developers to create unique and tailored images with ease. By leveraging guided prompts and adjustable parameters, you can explore a plethora of creative possibilities. Start integrating these capabilities into your applications today and elevate your image generation processes!