Create Stunning Images with the gan-tu/flux-dev-ai-signature Cognitive Actions

24 Apr 2025
Create Stunning Images with the gan-tu/flux-dev-ai-signature Cognitive Actions

In the world of artificial intelligence, generating images from textual descriptions has become increasingly powerful and accessible. The gan-tu/flux-dev-ai-signature provides a versatile set of Cognitive Actions that allow developers to create images tailored to their needs. With the ability to customize parameters like dimensions, models, and quality, integrating these actions into your applications can enhance user experience and creativity significantly.

Prerequisites

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

  • An API key for the Cognitive Actions platform.
  • Basic understanding of JSON structure and RESTful APIs.

Authentication typically involves including your API key in the request headers. For example:

Authorization: Bearer YOUR_COGNITIVE_ACTIONS_API_KEY

Cognitive Actions Overview

Generate Image

The Generate Image action allows you to create images using descriptive text prompts for both image-to-image and inpainting modes. You can choose from different models optimized for quality or speed while customizing dimensions and other parameters.

Input

The input for this action is structured as follows:

{
  "prompt": "AISIGNATURE handwritten signature saying 'Sikai Xiao', black stylish calligraphy on white background. The person is a data analyst",
  "model": "dev",
  "goFast": false,
  "megapixels": "1",
  "aspectRatio": "1:1",
  "loraStrength": 1,
  "outputFormat": "jpg",
  "guidanceScale": 3,
  "outputQuality": 100,
  "promptStrength": 0.8,
  "numberOfOutputs": 4,
  "inferenceStepsCount": 28,
  "additionalLoraStrength": 1
}

Required Fields:

  • prompt: The textual description of the image to be generated.

Optional Fields:

  • model: Specify the model to use (e.g., "dev" or "schnell").
  • goFast: Boolean to enable a speed-optimized model.
  • megapixels: Approximate number of megapixels for the generated image.
  • aspectRatio: The desired aspect ratio for the final image.
  • loraStrength: Strength of the main LoRA.
  • outputFormat: Format of the output image (e.g., "jpg", "png").
  • guidanceScale: Guidance scale for the diffusion process.
  • outputQuality: Quality percentage of the output image.
  • promptStrength: Strength of the prompt in image generation.
  • numberOfOutputs: How many images to generate.
  • inferenceStepsCount: Number of denoising steps.
  • additionalLoraStrength: Strength for additional LoRA weights.

Output

Upon successfully executing the action, you will receive URLs pointing to the generated images. The response will look like this:

[
  "https://assets.cognitiveactions.com/invocations/94859799-5be0-45d0-a975-48311a85aad0/2019859b-3ebd-4450-a98d-149bf7991220.jpg",
  "https://assets.cognitiveactions.com/invocations/94859799-5be0-45d0-a975-48311a85aad0/9b5b76c5-dc58-41fa-a714-c1fd75ea1a77.jpg",
  "https://assets.cognitiveactions.com/invocations/94859799-5be0-45d0-a975-48311a85aad0/0d89f6a4-d604-4c10-abfa-8665849ed46d.jpg",
  "https://assets.cognitiveactions.com/invocations/94859799-5be0-45d0-a975-48311a85aad0/ada5c569-2e6b-497b-b9e9-c0486c4662e1.jpg"
]

Conceptual Usage Example (Python)

Here is a conceptual example of how to use the Generate Image action using Python:

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 = "51feb277-d8af-4450-b198-0c3b06a8329a" # Action ID for Generate Image

# Construct the input payload based on the action's requirements
payload = {
    "prompt": "AISIGNATURE handwritten signature saying 'Sikai Xiao', black stylish calligraphy on white background. The person is a data analyst",
    "model": "dev",
    "goFast": False,
    "megapixels": "1",
    "aspectRatio": "1:1",
    "loraStrength": 1,
    "outputFormat": "jpg",
    "guidanceScale": 3,
    "outputQuality": 100,
    "promptStrength": 0.8,
    "numberOfOutputs": 4,
    "inferenceStepsCount": 28,
    "additionalLoraStrength": 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}
    )
    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 the YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The payload variable contains the necessary input structured according to the action's requirements. The request is sent to a hypothetical endpoint to generate images based on your prompt.

Conclusion

The gan-tu/flux-dev-ai-signature Cognitive Action empowers developers to integrate image generation capabilities into their applications effortlessly. By leveraging this action, you can create stunning visuals tailored to your specifications, enhancing the overall user experience. Explore the potential of image generation today and consider implementing these actions in your next project!