Create Stunning Visuals with the fofr/flux-condensation Cognitive Actions

23 Apr 2025
Create Stunning Visuals with the fofr/flux-condensation Cognitive Actions

In today's digital landscape, the ability to generate unique and visually appealing content is invaluable. The fofr/flux-condensation Cognitive Actions provide developers with powerful tools to create stunning images based on text prompts, specifically designed to mimic the artistic style of condensation. By leveraging advanced image inpainting and generation techniques, these pre-built actions simplify the process of transforming creative ideas into visual masterpieces.

Prerequisites

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

  • An API key for the Cognitive Actions platform, which will enable you to authenticate your requests.
  • Familiarity with making HTTP requests and handling JSON payloads.

In general, authentication is achieved by including your API key in the request headers. This ensures secure access to the functionality provided by the Cognitive Actions.

Cognitive Actions Overview

Generate Condensation Art

The Generate Condensation Art action allows users to create and visualize artwork in a condensation style. This operation utilizes image generation techniques to transform textual descriptions into unique visual representations.

Category: Image Generation

Input

The input for this action requires a JSON payload with the following fields:

  • prompt (required): A string that describes the image you wish to generate. For example, "the words \"condensation lora\" written in CONDENSATION on a window".
  • mask (optional): A URI pointing to an image mask for inpainting (if provided, width and height inputs are ignored).
  • seed (optional): An integer for setting a random seed, ensuring reproducibility.
  • image (optional): A URI pointing to an input image for inpainting (if provided, width and height inputs are ignored).
  • model (optional): Specifies the model to use, either "dev" or "schnell" (default is "dev").
  • width (optional): An integer defining the image width (only relevant for custom aspect ratios).
  • height (optional): An integer defining the image height (only relevant for custom aspect ratios).
  • goFast (optional): A boolean to enable faster predictions (default is false).
  • aspectRatio (optional): Specifies the aspect ratio for the generated image (default is "1:1").
  • outputFormat (optional): The format of the output image (default is "webp").
  • guidanceScale (optional): A number to guide the diffusion process (default is 3).
  • outputQuality (optional): An integer for the quality of the output image (default is 80).
  • promptStrength (optional): A number representing the strength of the prompt when using img2img (default is 0.8).
  • numberOfOutputs (optional): An integer for the number of output images to generate (default is 1).
  • numInferenceSteps (optional): An integer for the number of denoising steps (default is 28).

Example Input:

{
  "model": "dev",
  "goFast": false,
  "prompt": "the words \"condensation lora\" written in CONDENSATION on a window",
  "loraScale": 1,
  "megapixels": "1",
  "aspectRatio": "3:2",
  "outputFormat": "jpg",
  "guidanceScale": 3,
  "outputQuality": 80,
  "promptStrength": 0.8,
  "numberOfOutputs": 1,
  "numInferenceSteps": 28,
  "additionalLoraScale": 1
}

Output

The action returns a URL pointing to the generated image. For instance:

[
  "https://assets.cognitiveactions.com/invocations/9e19f67a-ab59-48ff-bf51-446f8e4e11de/1931afcb-73b8-4ec9-b1d5-32d6adf0c351.jpg"
]

Conceptual Usage Example (Python)

Here’s how you might call the Generate Condensation Art action using a conceptual Python snippet:

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 = "b7f101c8-58ad-4dcb-9ea6-82a32fbe2491" # Action ID for Generate Condensation Art

# Construct the input payload based on the action's requirements
payload = {
    "model": "dev",
    "goFast": False,
    "prompt": "the words \"condensation lora\" written in CONDENSATION on a window",
    "loraScale": 1,
    "megapixels": "1",
    "aspectRatio": "3:2",
    "outputFormat": "jpg",
    "guidanceScale": 3,
    "outputQuality": 80,
    "promptStrength": 0.8,
    "numberOfOutputs": 1,
    "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, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The payload variable is structured according to the input schema, and the action ID corresponds to the Generate Condensation Art action.

Conclusion

The fofr/flux-condensation Cognitive Actions empower developers to easily generate stunning images from text prompts, offering a creative outlet for applications in art, design, and more. By utilizing these powerful tools, you can enhance your applications with visually appealing content, making them stand out in a competitive landscape. Explore the various parameters and experiment with different prompts to unlock the full potential of this innovative action!