Create Stunning Neo-Impressionism Images with Cognitive Actions for flux-neo-impressionism

24 Apr 2025
Create Stunning Neo-Impressionism Images with Cognitive Actions for flux-neo-impressionism

In the world of AI-generated art, the ability to create visually stunning images using advanced models is revolutionizing the creative process. The flux-neo-impressionism spec provides powerful Cognitive Actions that enable developers to generate Neo-Impressionism style images through a customizable API. By leveraging these pre-built actions, developers can seamlessly integrate artistic capabilities into their applications, allowing for diverse creative expression without needing extensive expertise in machine learning.

Prerequisites

To get started with the Cognitive Actions in the flux-neo-impressionism spec, you'll need a few essential components:

  • API Key: You must have an API key for accessing the Cognitive Actions platform. This key will authenticate your requests.
  • Basic Setup: Familiarity with making HTTP requests and handling JSON payloads will be beneficial.

To authenticate your API requests, you will typically pass your API key in the headers of your requests.

Cognitive Actions Overview

Generate Neo-Impressionism Image

The Generate Neo-Impressionism Image action allows you to create an image in the unique style of Neo-Impressionism using a flux fine-tune model. This action is highly customizable, enabling you to adjust various image properties such as aspect ratio, resolution, and more.

Input

The following schema outlines the required and optional fields for the action's input:

  • Required:
    • prompt: A text description that guides the generation of the image.
  • Optional:
    • mask: A URI for an image mask, used for inpainting.
    • seed: An integer to set the random seed for reproducibility.
    • image: A URI for an input image for image-to-image transformations.
    • width: The width of the generated image (if aspect_ratio is 'custom').
    • height: The height of the generated image (if aspect_ratio is 'custom').
    • fastMode: Boolean to enable a speed-optimized model.
    • denoiseSteps: Number of denoising steps (default is 28).
    • resultFormat: The format of the output image (default is 'webp').
    • customWeights: URI for loading custom LoRA weights.
    • loraIntensity: Intensity scale for applying the main LoRA (default is 1).
    • resultQuality: Image quality scale (default is 80).
    • inferenceModel: Selects the model for inference (default is 'dev').
    • imageResolution: Resolution in megapixels for the generated image.
    • numberOfOutputs: The count of image outputs to generate (default is 1).
    • promptIntensity: Strength of the prompt in img2img mode (default is 0.8).
    • creativeGuidance: Guidance scale for the diffusion process (default is 3).
    • imageAspectRatio: Defines the aspect ratio (default is '1:1').
    • safetyCheckDisabled: Toggle for enabling/disabling the safety checker.

Example Input:

{
  "prompt": "a neo-impressionism closeup portrait painting of a futuristic cyberpunk, a busy street in the background, neon",
  "denoiseSteps": 28,
  "resultFormat": "webp",
  "loraIntensity": 1,
  "resultQuality": 90,
  "inferenceModel": "dev",
  "numberOfOutputs": 1,
  "promptIntensity": 0.8,
  "creativeGuidance": 3.5,
  "imageAspectRatio": "3:4",
  "additionalLoraIntensity": 1
}

Output

Upon successful execution, the action returns a link to the generated image in the specified format.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/f5dcc087-6a5d-428e-90f3-53c98cbce9d7/a68701ee-0d6e-4ee9-82ea-e531676b6b0f.webp"
]

Conceptual Usage Example (Python)

Here’s a conceptual Python snippet demonstrating how to call the Generate Neo-Impressionism 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 = "313a7cc8-4700-42a0-84ae-1a0cb94a49a1"  # Action ID for Generate Neo-Impressionism Image

# Construct the input payload based on the action's requirements
payload = {
    "prompt": "a neo-impressionism closeup portrait painting of a futuristic cyberpunk, a busy street in the background, neon",
    "denoiseSteps": 28,
    "resultFormat": "webp",
    "loraIntensity": 1,
    "resultQuality": 90,
    "inferenceModel": "dev",
    "numberOfOutputs": 1,
    "promptIntensity": 0.8,
    "creativeGuidance": 3.5,
    "imageAspectRatio": "3:4",
    "additionalLoraIntensity": 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 snippet, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The payload section is structured based on the required input, ensuring that all necessary parameters are included for a successful image generation request.

Conclusion

The flux-neo-impressionism Cognitive Action for generating Neo-Impressionism images opens up exciting possibilities for developers looking to integrate creative image generation into their applications. By leveraging the customizable parameters, you can fine-tune the results to suit your specific needs and artistic vision. Start exploring how to apply these actions in your projects and unleash your creativity!