Generate Stunning Custom Images with kayaeh/emile_flux Cognitive Actions

In the world of image generation, the kayaeh/emile_flux spec provides powerful Cognitive Actions that allow developers to create stunning customized images tailored to specific requirements. These actions leverage advanced models optimized for quality and speed, making it easier to produce high-quality graphics for various applications. By using these pre-built actions, developers can save time and resources while achieving impressive visual outputs.
Prerequisites
Before you start integrating the Cognitive Actions from the kayaeh/emile_flux spec, ensure you have the following prerequisites in place:
- An API key for the Cognitive Actions platform to authenticate your requests.
- Basic knowledge of JSON structures and API usage.
Authentication is typically handled by passing your API key in the request headers, ensuring secure access to the Cognitive Actions.
Cognitive Actions Overview
Generate Customized Images
The Generate Customized Images action enables the creation of images using a composite request. This action supports various features, including image masks, specified dimensions, and quality settings. It is perfect for applications that require flexibility in image generation, allowing for multiple output formats and aspect ratio specifications.
Input
The input for this action is structured as follows:
{
"prompt": "Your descriptive prompt here",
"model": "dev",
"loraIntensity": 1,
"numberOfOutputs": 1,
"promptIntensity": 0.8,
"imageAspectRatio": "1:1",
"imageOutputFormat": "webp",
"imageOutputQuality": 90,
"inferenceStepsCount": 28,
"diffusionGuidanceScale": 3.5,
"additionalLoraIntensity": 1
}
Required Fields:
prompt: A descriptive prompt that guides the image generation.
Optional Fields:
model: Choose betweendevfor quality orschnellfor speed (default isdev).loraIntensity: Determines the intensity of the primary LoRA weight (default is 1).numberOfOutputs: The number of images to generate (default is 1).promptIntensity: Strength of the prompt when using img2img (default is 0.8).imageAspectRatio: Aspect ratio for the generated image (default is1:1).imageOutputFormat: Format of the output image (default iswebp).imageOutputQuality: Quality of the output image, ranging from 0 to 100 (default is 80).inferenceStepsCount: Number of denoising steps to improve detail (default is 28).diffusionGuidanceScale: Guides the diffusion process for realism (default is 3).additionalLoraIntensity: Intensity for any additional LoRA weights (default is 1).
Example Input
Here’s an example payload for invoking this action:
{
"model": "dev",
"prompt": "Picture URF in a smoky, dimly-lit pirate tavern, his rugged 28-year-old figure leaning confidently over a barrel. He’s surrounded by a colorful cast of raucous, brawling pirates. The walls are decorated with old maps and pirate flags, tankards overflowing, and URF’s face is alight with a mischievous grin as he tells tales of his adventures on the high seas.",
"loraIntensity": 1,
"numberOfOutputs": 1,
"promptIntensity": 0.8,
"imageAspectRatio": "1:1",
"imageOutputFormat": "webp",
"imageOutputQuality": 90,
"inferenceStepsCount": 28,
"diffusionGuidanceScale": 3.5,
"additionalLoraIntensity": 1
}
Output
Upon successful execution, the action returns a URL pointing to the generated image. For example:
[
"https://assets.cognitiveactions.com/invocations/5e24e7fe-1369-4f59-85a1-45f2e387d073/bc6c463b-882c-4dbd-b43c-6037674deb8c.webp"
]
Conceptual Usage Example (Python)
Here’s how you might call the Generate Customized Images 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 = "e2949671-914a-41e8-bc3a-85b0df8137e3" # Action ID for Generate Customized Images
# Construct the input payload based on the action's requirements
payload = {
"model": "dev",
"prompt": "Picture URF in a smoky, dimly-lit pirate tavern, his rugged 28-year-old figure leaning confidently over a barrel. He’s surrounded by a colorful cast of raucous, brawling pirates. The walls are decorated with old maps and pirate flags, tankards overflowing, and URF’s face is alight with a mischievous grin as he tells tales of his adventures on the high seas.",
"loraIntensity": 1,
"numberOfOutputs": 1,
"promptIntensity": 0.8,
"imageAspectRatio": "1:1",
"imageOutputFormat": "webp",
"imageOutputQuality": 90,
"inferenceStepsCount": 28,
"diffusionGuidanceScale": 3.5,
"additionalLoraIntensity": 1
}
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_KEYwith your actual API key. - The
action_idcorresponds to the Generate Customized Images action. - The
payloadis structured according to the input schema, ensuring all required fields are included.
Conclusion
The kayaeh/emile_flux Cognitive Action for generating customized images empowers developers to create tailored visuals effortlessly. With its flexible input parameters and various output formats, you can easily integrate this action into your applications. Explore the capabilities of these actions further, and consider how they can enhance your projects with stunning graphics. Start experimenting today!