Create Stunning Character Images with fabiotgolo/imatheus Cognitive Actions

In the realm of digital creativity, the fabiotgolo/imatheus Cognitive Actions provide developers with powerful tools to generate visually striking images. This API offers a seamless way to bring characters to life from the short AI film Boitatá, utilizing advanced models that allow for customization in both speed and detail. Whether you're building a game, an animated series, or any creative application, these pre-built actions can save you time and enhance your project.
Prerequisites
Before you dive into using the Cognitive Actions, ensure you have:
- An API key for the Cognitive Actions platform.
- Basic understanding of RESTful API concepts.
Authentication typically involves passing your API key in the request headers, allowing you to securely access the Cognitive Actions functionalities.
Cognitive Actions Overview
Generate Boitatá Character Image
The Generate Boitatá Character Image action is designed to create images of the Boitatá character based on a text prompt. You can choose between two models—dev for detailed results and schnell for faster outputs—while customizing aspects like image resolution and style.
Input
The action requires a JSON input schema that includes various parameters. Here’s a breakdown of the key fields:
- prompt (required): A text description of the character you wish to generate.
- model (optional): Select either
"dev"or"schnell"; the default is"dev". - width (optional): Sets the image width (must be between 256 and 1440).
- height (optional): Sets the image height (must be between 256 and 1440).
- numberOfOutputs (optional): Specifies how many images to generate (default is 1).
Here’s an example of a valid input JSON:
{
"model": "dev",
"prompt": "IMATHEUS with his thick eyeglasses, wearing a blue shirt, trembling holding a gallon of gasoline in each hand.",
"mainLoraScale": 1,
"numberOfOutputs": 1,
"imageAspectRatio": "1:1",
"imageOutputFormat": "png",
"imageGuidanceScale": 2.03,
"imageOutputQuality": 100,
"additionalLoraScale": 1,
"imagePromptStrength": 0.84,
"numberOfInferenceSteps": 28
}
Output
Upon a successful request, you will receive a JSON response containing the URL of the generated image. Here’s an example of what you might receive:
[
"https://assets.cognitiveactions.com/invocations/3fe9d664-8bc1-47ca-b1a5-168095bdbf65/f0c7b057-e1dd-4ab2-add0-1d91ecff740b.png"
]
This URL points to the generated image of your specified character, which you can then use in your application.
Conceptual Usage Example (Python)
Below is a conceptual Python code snippet illustrating how to call the Cognitive Actions execution endpoint for 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 = "ba87868f-ccd3-42b8-a653-b35876f76616" # Action ID for Generate Boitatá Character Image
# Construct the input payload based on the action's requirements
payload = {
"model": "dev",
"prompt": "IMATHEUS with his thick eyeglasses, wearing a blue shirt, trembling holding a gallon of gasoline in each hand.",
"mainLoraScale": 1,
"numberOfOutputs": 1,
"imageAspectRatio": "1:1",
"imageOutputFormat": "png",
"imageGuidanceScale": 2.03,
"imageOutputQuality": 100,
"additionalLoraScale": 1,
"imagePromptStrength": 0.84,
"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 script:
- Replace
YOUR_COGNITIVE_ACTIONS_API_KEYwith your actual API key. - The
action_idshould correspond to the action you want to execute. - The input payload is structured to match the required schema, ensuring correct execution.
Conclusion
The fabiotgolo/imatheus Cognitive Actions offer a robust solution for developers looking to integrate character image generation into their applications. With customizable parameters and flexible models, you can easily create unique and high-quality images that enhance your projects. Consider exploring additional use cases, such as integrating these images into web applications, games, or interactive storytelling platforms to maximize the potential of these powerful tools. Happy coding!