Generate Stunning Images with the fofr/flux-tesla-robovan Cognitive Actions

23 Apr 2025
Generate Stunning Images with the fofr/flux-tesla-robovan Cognitive Actions

In the realm of AI-driven creativity, the fofr/flux-tesla-robovan Cognitive Actions provide developers with powerful tools to generate stunning images based on textual prompts. Utilizing advanced models, these actions can transform ideas into visually appealing images, enabling a range of applications from marketing to art generation. With the ability to customize various parameters, developers can create unique visuals that align perfectly with their project requirements.

Prerequisites

To start using the Cognitive Actions, you will need:

  • An API key for the Cognitive Actions platform.
  • Basic knowledge of JSON and API interactions.

Authentication typically involves sending the API key in the request headers. This ensures that your application can securely access the Cognitive Actions services.

Cognitive Actions Overview

Generate Image with Flux LoRA

The Generate Image with Flux LoRA action leverages the Flux LoRA model to create images from textual descriptions. It supports both text-to-image generation and image-to-image transformations, allowing for a rich creative experience. This action provides numerous configuration options such as aspect ratio, image dimensions, and output quality, making it suitable for various creative needs.

Input

The input for this action requires a JSON object with the following schema:

  • prompt (required): A string that describes the image to be generated.
  • modelType (optional): Specifies the model to be used ('dev' or 'schnell').
  • outputCount (optional): The number of output images to generate (1-4).
  • mainLoraScale (optional): A scale factor for the main LoRA.
  • imageAspectRatio (optional): The desired aspect ratio of the image.
  • imageOutputFormat (optional): The format of the output image (e.g., 'webp', 'jpg').
  • imageOutputQuality (optional): The quality of the output image (0-100).
  • inferenceStepCount (optional): The number of denoising steps for image generation.
  • additionalLoraScale (optional): A scale factor for any additional LoRAs.
  • imagePromptStrength (optional): Strength of the prompt when using image-to-image.
  • diffusionGuidanceScale (optional): Scale for the diffusion process.
  • deactivateSafetyChecker (optional): Option to disable safety checks.

Example Input

Here’s how the input JSON might look:

{
  "prompt": "A photo of a Tesla ROBOVAN. Futuristic streamlined vehicle parked on a city street, sleek aerodynamic design, silver and black color scheme with horizontal stripes. Next to the Golden Gate bridge",
  "modelType": "dev",
  "outputCount": 1,
  "mainLoraScale": 1,
  "imageAspectRatio": "3:2",
  "imageOutputFormat": "webp",
  "imageOutputQuality": 90,
  "inferenceStepCount": 28,
  "additionalLoraScale": 1,
  "imagePromptStrength": 0.8,
  "diffusionGuidanceScale": 3.5,
  "deactivateSafetyChecker": false
}

Output

Upon successful execution, the action returns a URL pointing to the generated image. Here's an example of what the output might look like:

[
  "https://assets.cognitiveactions.com/invocations/230831ba-671f-44df-8030-3b083f45de71/1a1eea50-861a-4bde-bc00-e78685d53224.webp"
]

Conceptual Usage Example (Python)

Below is a conceptual Python code snippet demonstrating how to invoke the Generate Image 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 = "ec6d063f-f537-4ff6-8494-b3878102af4c" # Action ID for Generate Image with Flux LoRA

# Construct the input payload based on the action's requirements
payload = {
    "prompt": "A photo of a Tesla ROBOVAN. Futuristic streamlined vehicle parked on a city street, sleek aerodynamic design, silver and black color scheme with horizontal stripes. Next to the Golden Gate bridge",
    "modelType": "dev",
    "outputCount": 1,
    "mainLoraScale": 1,
    "imageAspectRatio": "3:2",
    "imageOutputFormat": "webp",
    "imageOutputQuality": 90,
    "inferenceStepCount": 28,
    "additionalLoraScale": 1,
    "imagePromptStrength": 0.8,
    "diffusionGuidanceScale": 3.5,
    "deactivateSafetyChecker": false
}

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 YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key.
  • The action ID is specifically for generating images using the Flux LoRA model.
  • The input payload is structured according to the requirements defined in the action schema.

Conclusion

The fofr/flux-tesla-robovan Cognitive Actions provide developers with an innovative way to generate images from text prompts, leveraging powerful AI models. By customizing various parameters, you can produce high-quality, unique images tailored to your application needs. Consider experimenting with different prompts and settings to explore the full capabilities of this action, and unlock new creative possibilities for your projects!