Generate Stunning Visuals with genia-lab/fluxioai-lora Cognitive Actions

23 Apr 2025
Generate Stunning Visuals with genia-lab/fluxioai-lora Cognitive Actions

In today's fast-paced digital world, creating high-quality images quickly and efficiently is essential for developers and content creators alike. The genia-lab/fluxioai-lora Cognitive Actions offer a powerful toolset for generating customized images using advanced LoRA models. With features like inpainting, adjustable dimensions, and optimized performance modes, these actions are designed to enhance your application’s capabilities in image generation. Let's dive into how you can leverage these Cognitive Actions to transform your projects.

Prerequisites

To get started with the Cognitive Actions, you'll need an API key for the platform. This key should be included in the headers of your requests for authentication purposes. Generally, you will pass the API key as follows:

Authorization: Bearer YOUR_COGNITIVE_ACTIONS_API_KEY

Cognitive Actions Overview

Generate Image with LoRA Inpainting

The Generate Image with LoRA Inpainting action allows you to create tailored images using the LoRA model. You can take advantage of features like inpainting and custom aspect ratios to achieve high-quality outputs that suit your needs.

Input

The input for this action is structured as follows:

{
  "prompt": "A modern and clean YouTube thumbnail featuring a smiling man with glasses and headphones on the right side of the image. The background is white and minimalistic. Bold, red and black text at the top says 'GANA $100 POR DÍA.' Below the text, a green ChatGPT logo with the word 'ChatGPT' next to it, and a black OBS logo labeled 'OBS.' A red arrow connects the two logos, creating a sense of flow. The overall design is vibrant, professional, and engaging, perfect for an educational video thumbnail about earning money online.",
  "goFast": false,
  "loraScale": 1,
  "numOutputs": 1,
  "guidanceScale": 3,
  "outputQuality": 80,
  "extraLoraScale": 1,
  "inferenceModel": "dev",
  "promptStrength": 0.8,
  "imageMegapixels": "1",
  "imageAspectRatio": "16:9",
  "imageOutputFormat": "webp",
  "numInferenceSteps": 28
}

Required fields:

  • prompt: A descriptive phrase or keywords to generate the image.

Optional fields:

  • mask: URI to an image mask for inpainting.
  • seed: An integer for consistent output generation.
  • image: URI to an input image for image-to-image or inpainting.
  • width: Width of the generated image (when aspect ratio is custom).
  • height: Height of the generated image (when aspect ratio is custom).
  • goFast: Enables fast prediction mode.
  • numOutputs: Number of image outputs to generate (1-4).
  • guidanceScale: Influences image realism (0-10).
  • outputQuality: Output image quality (0-100).
  • Additional fields for advanced customization.

Output

A successful execution of this action returns a list of generated image URLs. For example:

[
  "https://assets.cognitiveactions.com/invocations/82b3dd30-32c5-4c70-80d2-9fef8d80c19e/682f41ee-02d4-4221-89aa-27df532d7bef.webp"
]

Conceptual Usage Example (Python)

Here's a conceptual Python snippet demonstrating how to call the Generate Image with LoRA Inpainting 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 = "613772d3-44a1-4774-b07a-6c7f83e422fb"  # Action ID for Generate Image with LoRA Inpainting

# Construct the input payload based on the action's requirements
payload = {
    "prompt": "A modern and clean YouTube thumbnail featuring a smiling man with glasses and headphones on the right side of the image. The background is white and minimalistic. Bold, red and black text at the top says 'GANA $100 POR DÍA.' Below the text, a green ChatGPT logo with the word 'ChatGPT' next to it, and a black OBS logo labeled 'OBS.' A red arrow connects the two logos, creating a sense of flow. The overall design is vibrant, professional, and engaging, perfect for an educational video thumbnail about earning money online.",
    "goFast": False,
    "loraScale": 1,
    "numOutputs": 1,
    "guidanceScale": 3,
    "outputQuality": 80,
    "extraLoraScale": 1,
    "inferenceModel": "dev",
    "promptStrength": 0.8,
    "imageMegapixels": "1",
    "imageAspectRatio": "16:9",
    "imageOutputFormat": "webp",
    "numInferenceSteps": 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, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action_id should reflect the action you intend to execute, and the payload is structured according to the input requirements.

Conclusion

The genia-lab/fluxioai-lora Cognitive Actions provide a robust solution for developers looking to integrate advanced image generation capabilities into their applications. With features such as customizable prompts, fast prediction modes, and varying output formats, these tools can significantly enhance the creative process. Explore these actions today to elevate your projects and provide users with visually stunning content!