Generate Stunning Images with the fabiotgolo/ibruno Cognitive Actions

24 Apr 2025
Generate Stunning Images with the fabiotgolo/ibruno Cognitive Actions

The fabiotgolo/ibruno API provides developers with an exciting utility for generating images based on creative text prompts, specifically related to the character of the short AI film, Boitatá. By leveraging pre-built Cognitive Actions, developers can easily create stunning visuals tailored to their specifications, including customizable aspects like image dimensions, generation modes, and output formats. This blog post will guide you through the capabilities of the "Generate Image with Boitatá Character" action, ensuring you can integrate it seamlessly into your applications.

Prerequisites

Before diving into the Cognitive Actions, ensure you have the following:

  1. An API key for the Cognitive Actions platform.
  2. Basic understanding of JSON and API interaction.
  3. Familiarity with making HTTP requests in Python.

Authentication typically involves passing your API key in the request headers, allowing you to securely access the service.

Cognitive Actions Overview

Generate Image with Boitatá Character

This action is designed for generating images based on specified text prompts that relate to the Boitatá character. It supports various customization options, including image transformation, aspect ratio selection, and different modes for image generation—whether you need speed or detail.

Input

The input for this action requires a minimum of one field, prompt, and can include various optional parameters for fine-tuning the output. Below is the schema with an example input:

{
  "model": "dev",
  "prompt": "IBRUNO, wearing a regatta white t-shirt, with arms crossed.",
  "guidanceScale": 2.03,
  "mainLoraScale": 1,
  "promptStrength": 0.85,
  "numberOfOutputs": 1,
  "imageAspectRatio": "1:1",
  "outputImageFormat": "png",
  "imageOutputQuality": 100,
  "additionalLoraScale": 1,
  "numberOfInferenceSteps": 28
}
  • Required Field:
    • prompt: A descriptive string for generating the image.
  • Optional Fields:
    • model: Specifies the inference model to use (default is "dev").
    • guidanceScale: Adjusts the realism of the image (default is 3).
    • numberOfOutputs: Number of images to generate (default is 1).
    • imageAspectRatio: Sets the aspect ratio for the image output (default is "1:1").
    • outputImageFormat: Format for the output image (default is "webp").
    • And many more options for further customization.

Output

Upon a successful invocation, the action returns a URL pointing to the generated image. For example:

[
  "https://assets.cognitiveactions.com/invocations/a3502811-3e6e-48fd-a3cb-2722ded8bba6/cdcbb37e-dcde-4460-a9c5-9af7d490c0c8.png"
]

This URL can be used to access the generated image directly.

Conceptual Usage Example (Python)

Here's a conceptual example of how you might call the Cognitive Actions execution endpoint 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 = "a8be17e2-ffc6-4407-835f-6b41762c0595" # Action ID for Generate Image with Boitatá Character

# Construct the input payload based on the action's requirements
payload = {
  "model": "dev",
  "prompt": "IBRUNO, wearing a regatta white t-shirt, with arms crossed.",
  "guidanceScale": 2.03,
  "mainLoraScale": 1,
  "promptStrength": 0.85,
  "numberOfOutputs": 1,
  "imageAspectRatio": "1:1",
  "outputImageFormat": "png",
  "imageOutputQuality": 100,
  "additionalLoraScale": 1,
  "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 code snippet, replace the COGNITIVE_ACTIONS_API_KEY and endpoint URL with your own credentials. The payload variable constructs a JSON object based on the action's requirements, ensuring to include the action ID and input data correctly.

Conclusion

The fabiotgolo/ibruno Cognitive Action for generating images opens up a world of creative possibilities for developers looking to enhance their applications with dynamic visuals. By leveraging the various customization options, you can create unique and engaging content tailored to your needs. Start integrating these actions into your projects today and explore the endless opportunities for creativity!