Generate Stunning Images with Cognitive Actions for IMATHEUS

23 Apr 2025
Generate Stunning Images with Cognitive Actions for IMATHEUS

In today's digital landscape, creating compelling visual content is essential for engaging users and enhancing applications. The fabiotgolo/imatheusn API provides developers with advanced Cognitive Actions specifically designed for image generation. Among these actions, the ability to generate a detailed image of a character named IMATHEUS presents an exciting opportunity for developers to harness the power of AI in their projects. This article will guide you through the key features and usage of the Generate Image of IMATHEUS action, empowering you to integrate it seamlessly into your applications.

Prerequisites

Before you start using the Cognitive Actions, ensure you have the following:

  • An API key for the Cognitive Actions platform to authenticate your requests.
  • Basic knowledge of making HTTP requests and handling JSON data in your programming language of choice.

Authentication typically involves passing the API key in the request headers. This allows you to securely access the services provided by the Cognitive Actions API.

Cognitive Actions Overview

Generate Image of IMATHEUS

This action allows you to create a visually striking image of IMATHEUS, a robust man depicted in a left profile view. The image can be customized with various parameters such as dimensions, output quality, and prompt strength. This action falls under the category of image-generation.

Input: The input for this action is structured as follows:

{
  "model": "dev",
  "prompt": "IMATHEUSN, a robust man around 30 years old, rendered in a left profile view. He has small, oval-shaped eyes framed by slightly arched, thick eyebrows, wearing rectangular black-framed glasses that fit well on his face. His dark, slightly wavy, and full hair extends close to his ears. He has a neutral expression, with medium-sized lips and a proportionate nose with a rounded base. He is wearing a short-sleeved t-shirt in a vibrant canary yellow tone, paired with blue jeans and brown boots clearly visible. His build is broad and voluminous, with wide shoulders, giving him a strong and grounded presence. The background is neutral and simple.",
  "loraScale": 1,
  "numOutputs": 1,
  "aspectRatio": "1:1",
  "outputFormat": "png",
  "guidanceScale": 2,
  "outputQuality": 100,
  "promptStrength": 0.8,
  "numInferenceSteps": 28,
  "additionalLoraScale": 1
}
  • Required Fields:
    • prompt: A detailed description for the image generation.
  • Optional Fields:
    • model: The inference model to use (default: "dev").
    • loraScale, numOutputs, aspectRatio, outputFormat, guidanceScale, outputQuality, promptStrength, numInferenceSteps, and additionalLoraScale can be used to fine-tune the output.

Output: The output of this action is a URL linking to the generated image. For example:

[
  "https://assets.cognitiveactions.com/invocations/84219045-f2a5-47c2-8e4a-8dbf63d33b03/e068d139-073d-4bf2-b932-318cab0eead1.png"
]

This URL directs you to the resulting image, which you can display in your application.

Conceptual Usage Example (Python): Here’s how you can invoke this action using a hypothetical Cognitive Actions endpoint:

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 = "76f981ab-8595-46ad-af74-1c8764e28e1b" # Action ID for Generate Image of IMATHEUS

# Construct the input payload based on the action's requirements
payload = {
    "model": "dev",
    "prompt": "IMATHEUSN, a robust man around 30 years old, rendered in a left profile view. He has small, oval-shaped eyes framed by slightly arched, thick eyebrows, wearing rectangular black-framed glasses that fit well on his face. His dark, slightly wavy, and full hair extends close to his ears. He has a neutral expression, with medium-sized lips and a proportionate nose with a rounded base. He is wearing a short-sleeved t-shirt in a vibrant canary yellow tone, paired with blue jeans and brown boots clearly visible. His build is broad and voluminous, with wide shoulders, giving him a strong and grounded presence. The background is neutral and simple.",
    "loraScale": 1,
    "numOutputs": 1,
    "aspectRatio": "1:1",
    "outputFormat": "png",
    "guidanceScale": 2,
    "outputQuality": 100,
    "promptStrength": 0.8,
    "numInferenceSteps": 28,
    "additionalLoraScale": 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 example, you need to replace "YOUR_COGNITIVE_ACTIONS_API_KEY" with your actual API key. The payload is structured to match the required input schema, ensuring that your request can successfully generate the image of IMATHEUS.

Conclusion

The Generate Image of IMATHEUS action offers developers an exciting way to incorporate AI-driven image generation into their applications. With customizable parameters such as aspect ratio, output quality, and prompt strength, you can create unique visual representations tailored to your needs. As you explore this action, consider various use cases where dynamic image generation can enhance user experience and engagement. Happy coding!