Create Stunning Visuals with Voodoohop's Flux Dance Cognitive Actions

21 Apr 2025
Create Stunning Visuals with Voodoohop's Flux Dance Cognitive Actions

In the ever-evolving world of digital creativity, Voodoohop's Flux Dance provides developers with a powerful API to generate artistic images driven by narratives and audio files. This integration of audio and visual elements opens up new avenues for creativity, allowing for the creation of dynamic and engaging content. The Cognitive Actions in the "voodoohop/flux-dance" specification enable you to harness the power of AI to produce unique imagery with customizable parameters.

Prerequisites

Before diving into the usage of the Flux Dance Cognitive Actions, ensure you have the following:

  • An API key for the Cognitive Actions platform to authenticate your requests.
  • Basic knowledge of JSON and HTTP requests.

Authentication typically involves passing your API key in the headers of your HTTP requests.

Cognitive Actions Overview

Generate Flux Dance Image

The Generate Flux Dance Image action allows you to create artistic images based on specified narratives and optional audio files. You can select between different models and customize various parameters to get your desired output.

Input

The input for this action requires a JSON payload structured according to the following schema:

{
  "seed": 42,
  "width": 512,
  "height": 512,
  "audioFile": "https://replicate.delivery/pbxt/MjoiE505we3uNDCHqzp9ej88EYMmlGaX6y02Pn9fvlk2CfiO/test1.mp3",
  "modelName": "sd",
  "narrative": "a forgotten forest shining in its primordial state\na river flowing across a primordial forest\na little pond in a primordial forest\n",
  "styleSuffix": "by paul klee",
  "outputFormat": "png",
  "guidanceScale": 7.5,
  "audioSmoothing": 0.8,
  "framesPerSecond": 10,
  "audioLoudnessType": "peak",
  "variationStrength": 0.3,
  "interpolatePrompts": true,
  "interpolationSteps": 4
}
  • Required Fields:
    • narrative: A multi-line string guiding the image generation.
    • modelName: Specifies the model for image generation — either 'flux' or 'sd'.
  • Optional Fields:
    • seed: The random seed for initializing randomness.
    • width and height: Dimensions of the generated image.
    • audioFile: A URI to an audio file for driving interpolation.
    • styleSuffix: Additional style instructions.
    • outputFormat: Image output format (webp, jpg, png).
    • guidanceScale, audioSmoothing, framesPerSecond, audioLoudnessType, variationStrength, interpolatePrompts, interpolationSteps: Various parameters affecting image generation.

Output

Upon successful execution, the action returns a URL to the generated content. For example:

"https://assets.cognitiveactions.com/invocations/dd3a3e03-42ad-4701-b197-70e21dc34038/6a0ab0b5-0b89-4997-a41c-5583b7d748f8.mp4"

This URL points to an artistic video generated based on the input specifications.

Conceptual Usage Example (Python)

Here's a conceptual Python snippet demonstrating how to invoke the Generate Flux Dance Image 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 = "606e34d4-db19-43e5-be3f-4340a6415cee"  # Action ID for Generate Flux Dance Image

# Construct the input payload based on the action's requirements
payload = {
    "seed": 42,
    "width": 512,
    "height": 512,
    "audioFile": "https://replicate.delivery/pbxt/MjoiE505we3uNDCHqzp9ej88EYMmlGaX6y02Pn9fvlk2CfiO/test1.mp3",
    "modelName": "sd",
    "narrative": "a forgotten forest shining in its primordial state\na river flowing across a primordial forest\na little pond in a primordial forest\n",
    "styleSuffix": "by paul klee",
    "outputFormat": "png",
    "guidanceScale": 7.5,
    "audioSmoothing": 0.8,
    "framesPerSecond": 10,
    "audioLoudnessType": "peak",
    "variationStrength": 0.3,
    "interpolatePrompts": True,
    "interpolationSteps": 4
}

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 snippet, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The payload variable is structured to meet the action's input requirements, and the response is printed out for verification.

Conclusion

Voodoohop's Flux Dance Cognitive Actions offer a unique way to blend narrative and audio with visual artistry, enabling developers to create stunning visuals easily. By configuring the various parameters, you can tailor your creations to your specific needs. Whether for artistic projects, marketing materials, or interactive applications, these actions can significantly enhance your digital toolkit. Explore the possibilities and start integrating these powerful features into your applications today!