Create Stunning Retro Images with Floating Flux Cognitive Actions

24 Apr 2025
Create Stunning Retro Images with Floating Flux Cognitive Actions

In the world of digital creativity, generating unique artwork using AI is becoming increasingly accessible. The Floating Flux Cognitive Actions empower developers to harness the capabilities of AI for image generation, specifically focusing on retro-style art through the innovative Generate Retro Style Images with Flux LoRA action. This action allows for customizable generation settings, enabling developers to produce beautiful images tailored to their specific needs, all while optimizing for speed and precision.

Prerequisites

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

  • An API key for the Cognitive Actions platform, which will provide access to the required functionalities.
  • Familiarity with making HTTP requests and handling JSON data formats.

Authentication typically involves passing your API key within the request headers to access the Cognitive Actions API securely.

Cognitive Actions Overview

Generate Retro Style Images with Flux LoRA

The Generate Retro Style Images with Flux LoRA action allows you to create unique art using AI models that can be customized extensively. This action is categorized under image generation and supports various parameters to control the output.

Input

The input for this action is based on a JSON schema titled CompositeRequest. Here’s a breakdown of the required and optional fields:

  • Required:
    • prompt: A string that describes the image you want to generate (e.g., "red car driving, blue sky in the style of TOK").
  • Optional:
    • mask: An image mask for inpainting mode (URI).
    • seed: An integer for reproducible generation.
    • image: An input image for image-to-image or inpainting mode (URI).
    • model: Selects the inference model (dev or schnell).
    • width: Width of the generated image (256-1440, multiples of 16).
    • height: Height of the generated image (256-1440, multiples of 16).
    • goFast: A boolean to enable faster predictions.
    • imageAspectRatio: Aspect ratio of the generated image.
    • numberOfOutputs: Number of images to generate (1-4).
    • imageOutputFormat: Output format for the images (webp, jpg, png).
    • imageOutputQuality: Quality of the output images (0-100).
    • diffusionGuidanceScale: Scale for the diffusion process (0-10).
    • numberOfInferenceSteps: Number of denoising steps (1-50).

Example Input

{
  "model": "dev",
  "prompt": "red car driving, blue sky in the style of TOK",
  "loraScale": 1,
  "numberOfOutputs": 1,
  "imageAspectRatio": "1:1",
  "imageOutputFormat": "webp",
  "imageOutputQuality": 80,
  "diffusionGuidanceScale": 3.5,
  "numberOfInferenceSteps": 28
}

Output

The action returns a URL pointing to the generated image. Here’s an example of the output structure:

[
  "https://assets.cognitiveactions.com/invocations/92b0e4f4-7e16-4254-b415-6e63cf59e8c1/56a46ada-ada8-4f71-ab14-4c9553c70484.webp"
]

Conceptual Usage Example (Python)

Here's a conceptual Python snippet demonstrating how to invoke the Generate Retro Style Images with Flux LoRA 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 = "204ae625-132f-4cb4-8308-3f65c6140f20" # Action ID for Generate Retro Style Images with Flux LoRA

# Construct the input payload based on the action's requirements
payload = {
    "model": "dev",
    "prompt": "red car driving, blue sky in the style of TOK",
    "loraScale": 1,
    "numberOfOutputs": 1,
    "imageAspectRatio": "1:1",
    "imageOutputFormat": "webp",
    "imageOutputQuality": 80,
    "diffusionGuidanceScale": 3.5,
    "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, you replace the API key and endpoint with your actual values. The action ID and the structured JSON payload correspond with the requirements of the Generate Retro Style Images with Flux LoRA action.

Conclusion

The Floating Flux Cognitive Actions offer powerful capabilities for developers aiming to integrate AI-driven image generation into their applications. By utilizing the Generate Retro Style Images with Flux LoRA action, you can create stunning, customized artwork that meets your unique specifications. Explore the potential of these tools to elevate your creative projects and consider how you can incorporate them into your next application!