Generate Stunning Images with the kneelesh48/neelesh-flux Cognitive Actions

23 Apr 2025
Generate Stunning Images with the kneelesh48/neelesh-flux Cognitive Actions

In the realm of image generation, the kneelesh48/neelesh-flux Cognitive Actions provide developers with the powerful capability to create unique images using the Flux Lora model, trained on photos of Neelesh Kumar. These pre-built actions allow for fine-tuning of various image generation parameters, enabling high-quality output tailored to specific needs. By leveraging these actions, developers can enhance their applications with advanced image generation capabilities effortlessly.

Prerequisites

Before you get started with the Cognitive Actions, ensure you have:

  • An API key for the Cognitive Actions platform.
  • Familiarity with JSON structure, as inputs will be in this format.

Authentication typically involves passing your API key in the request headers to authorize your actions.

Cognitive Actions Overview

Generate Image Using Flux Lora Model

Purpose:
This action allows you to generate unique images using the Flux Lora model with customizable parameters such as aspect ratio, output format, and LoRA application intensity, ensuring high-quality imaging tailored to your specifications.

Category: Image Generation

Input

The input schema for this action requires a JSON object with various fields. The only required field is prompt, while others are optional for further customization.

Example Input:

{
  "model": "dev",
  "prompt": "Full body shot of NEELESH, a 25-year-old man walking through a narrow cobblestone street in Naples, looking up at hanging laundry between buildings, wearing fitted lenin pants, a white linen shirt and tan leather shoes, candid moment as he explores, colorful Italian architecture in background, natural daylight",
  "fastMode": false,
  "loraScale": 1,
  "guidanceScale": 3,
  "outputQuality": 80,
  "inferenceSteps": 28,
  "numberOfOutputs": 4,
  "imageAspectRatio": "3:4",
  "imageOutputFormat": "png",
  "additionalLoraScale": 1,
  "imagePromptStrength": 0.8,
  "approximateMegapixels": "1"
}

Input Fields:

  • prompt (required): Describes the image to be generated.
  • model: Selects the generation model, with options like dev and schnell.
  • fastMode: Enables faster predictions.
  • loraScale: Controls the intensity of the LoRA application.
  • guidanceScale: Affects the realism of the generated images.
  • outputQuality: Determines the quality of the output images (0-100).
  • inferenceSteps: Number of denoising steps for detail.
  • numberOfOutputs: Number of images to generate.
  • imageAspectRatio: Aspect ratio of the generated image.
  • imageOutputFormat: Format of the output images.
  • Additional fields for fine-tuning such as additionalLoraScale and imagePromptStrength.

Output

The output of this action typically returns an array of URLs pointing to the generated images.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/d378c612-aea5-4fc7-b405-3295115bbe68/e177525c-e41d-4e0d-b876-218819e103d3.png",
  "https://assets.cognitiveactions.com/invocations/d378c612-aea5-4fc7-b405-3295115bbe68/94accb5f-c0cc-43bc-9773-35c62f10cb97.png",
  "https://assets.cognitiveactions.com/invocations/d378c612-aea5-4fc7-b405-3295115bbe68/bed0eec0-3747-4a1e-a753-1c405fe73fb7.png",
  "https://assets.cognitiveactions.com/invocations/d378c612-aea5-4fc7-b405-3295115bbe68/93e79fd2-6f29-4fb7-841a-e7c4fbf1e4b4.png"
]

Conceptual Usage Example (Python)

Here’s how you might call this action using Python, structuring the input payload as required:

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 = "91464a76-5b8f-44a2-87c8-bdd855cf4c11"  # Action ID for Generate Image Using Flux Lora Model

# Construct the input payload based on the action's requirements
payload = {
    "model": "dev",
    "prompt": "Full body shot of NEELESH, a 25-year-old man walking through a narrow cobblestone street in Naples, looking up at hanging laundry between buildings, wearing fitted lenin pants, a white linen shirt and tan leather shoes, candid moment as he explores, colorful Italian architecture in background, natural daylight",
    "fastMode": False,
    "loraScale": 1,
    "guidanceScale": 3,
    "outputQuality": 80,
    "inferenceSteps": 28,
    "numberOfOutputs": 4,
    "imageAspectRatio": "3:4",
    "imageOutputFormat": "png",
    "additionalLoraScale": 1,
    "imagePromptStrength": 0.8,
    "approximateMegapixels": "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 code snippet, you replace the placeholder API key and endpoint with actual values. The payload is constructed according to the action's requirements, ensuring the prompt and other parameters are included. The output result will contain URLs of the generated images.

Conclusion

The kneelesh48/neelesh-flux Cognitive Actions provide a robust solution for developers looking to integrate advanced image generation capabilities into their applications. By leveraging the parameters available, you can create stunning and personalized images that enhance user experiences. Explore further by experimenting with different prompts and configurations to fully harness the potential of this powerful action!