Create Stunning Día de Muertos Catrina Images with the Catrina Cognitive Actions

In the vibrant world of Día de Muertos, the Catrina figure stands as an iconic symbol of remembrance. The Catrina Cognitive Actions from the grabielairu/catrina spec allows developers to seamlessly integrate AI-generated images inspired by this cultural legacy into their applications. These pre-built actions simplify the creation of custom images, offering a range of parameters to tailor the output to your specific needs.
Prerequisites
To get started with the Catrina Cognitive Actions, you'll need:
- An API key for the Cognitive Actions platform. This key will authenticate your requests.
- Basic knowledge of JSON structure and HTTP requests, as the Cognitive Actions will expect input in JSON format.
Authentication typically involves passing your API key in the HTTP headers when making requests.
Cognitive Actions Overview
Generate Día de Muertos Catrina Images
Purpose:
This action allows you to create stunning AI-generated images inspired by Día de Muertos’ Catrina pictures using a fine-tuned model. You can customize various aspects of the image, including prompt strength, number of outputs, and image refinement strategies.
Category: image-generation
Input
The action requires a structured input, detailed as follows:
{
"mask": "string (optional)",
"seed": "integer (optional)",
"image": "string (optional)",
"width": "integer (default: 1024)",
"height": "integer (default: 1024)",
"prompt": "string (default: 'An astronaut riding a rainbow unicorn')",
"refine": "string (default: 'no_refiner')",
"scheduler": "string (default: 'K_EULER')",
"loraWeights": "string (optional)",
"refineSteps": "integer (optional)",
"applyWatermark": "boolean (default: true)",
"negativePrompt": "string (default: '')",
"promptStrength": "number (default: 0.8, range: 0-1)",
"loraScaleFactor": "number (default: 0.6, range: 0-1)",
"numberOfOutputs": "integer (default: 1, range: 1-4)",
"highNoiseFraction": "number (default: 0.8, range: 0-1)",
"guidanceScaleFactor": "number (default: 7.5, range: 1-50)",
"disableSafetyChecker": "boolean (default: false)",
"numberOfInferenceSteps": "integer (default: 50, range: 1-500)"
}
Example Input:
{
"width": 1024,
"height": 1024,
"prompt": "Picture of Taylor swift as TOK catrina",
"refine": "no_refiner",
"scheduler": "K_EULER",
"applyWatermark": true,
"promptStrength": 0.8,
"loraScaleFactor": 0.6,
"numberOfOutputs": 1,
"highNoiseFraction": 0.8,
"guidanceScaleFactor": 7.5,
"numberOfInferenceSteps": 50
}
Output
The action typically returns an array of URLs pointing to the generated images. Here’s an example output:
[
"https://assets.cognitiveactions.com/invocations/f7c07338-3f85-44b0-8382-3ccf1e07acfe/ab2ee92c-444e-4ae1-9152-3a1a288c0339.png"
]
Conceptual Usage Example (Python)
Here’s a conceptual Python snippet to demonstrate how to call this 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 = "b1cb829f-fa2d-4703-9041-28a23fe3d10c" # Action ID for Generate Día de Muertos Catrina Images
# Construct the input payload based on the action's requirements
payload = {
"width": 1024,
"height": 1024,
"prompt": "Picture of Taylor swift as TOK catrina",
"refine": "no_refiner",
"scheduler": "K_EULER",
"applyWatermark": True,
"promptStrength": 0.8,
"loraScaleFactor": 0.6,
"numberOfOutputs": 1,
"highNoiseFraction": 0.8,
"guidanceScaleFactor": 7.5,
"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}")
In the code snippet above, replace the YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action_id corresponds to the "Generate Día de Muertos Catrina Images" action. The payload is constructed according to the required input schema.
Conclusion
The Catrina Cognitive Actions empower developers to create unique and culturally rich images with ease. By leveraging the flexibility of customizable inputs, you can generate a variety of stunning visuals for your applications. Explore the endless possibilities of AI-generated imagery, and consider integrating these actions into your projects to enhance user engagement and creativity!