Generate Stunning Images with the Jugo Flux LoRA Cognitive Actions

24 Apr 2025
Generate Stunning Images with the Jugo Flux LoRA Cognitive Actions

The klassenmedia/jugo-flux-lora API empowers developers to create high-quality images using advanced LoRA (Low-Rank Adaptation) technology. With customizable parameters, this API simplifies image generation, allowing for tailored outputs based on specific needs such as aspect ratio, resolution, and LoRA intensity. Leveraging these pre-built Cognitive Actions can significantly streamline the process of integrating image generation capabilities into your applications.

Prerequisites

To begin using the Cognitive Actions provided by the klassenmedia/jugo-flux-lora API, make sure you have the following:

  • An API key for the Cognitive Actions platform.
  • Basic familiarity with making HTTP requests and handling JSON data.
  • A Python environment set up with the requests library installed for making API calls.

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

Cognitive Actions Overview

Generate Images with LoRA

Description:
This action generates high-quality images based on a text prompt, utilizing LoRA technology. It offers various customizable parameters, making it suitable for diverse image generation tasks.

Category: Image Generation

Input

The input schema requires the following fields:

  • prompt (required): A detailed text description of the image to be generated.
  • width (optional): Width of the generated image (when aspect ratio is custom).
  • height (optional): Height of the generated image (when aspect ratio is custom).
  • goFast (optional): Boolean to enable faster predictions.
  • imageAspectRatio (optional): Aspect ratio of the output image.
  • imageOutputFormat (optional): Format of the output image (e.g., webp, jpg, png).
  • numberOfOutputs (optional): Number of images to generate.
  • guidanceScale (optional): Determines how closely the output should follow the prompt.
  • additionalLoraScale (optional): Scale factor for applying additional LoRA models.

Example Input:

{
  "width": 720,
  "goFast": false,
  "height": 1280,
  "prompt": "JUGO, a confident and beautiful woman with light auburn, wavy hair, standing in front of the brandenburger tor in germany with her arms crossed, wearing a figure-hugging, knee-length dress in a vibrant fuchsia tone with three-quarter sleeves. Her expression is warm and approachable, with a professional yet relaxed demeanor, captured in soft natural lighting that enhances the urban background, full-body, wide angle",
  "loraScale": 1,
  "modelType": "dev",
  "megapixels": "1",
  "guidanceScale": 2,
  "promptStrength": 0.8,
  "numberOfOutputs": 3,
  "imageAspectRatio": "9:16",
  "imageOutputFormat": "webp",
  "numInferenceSteps": 35,
  "imageOutputQuality": 100,
  "additionalLoraScale": 1
}

Output

The output will typically include a list of URLs pointing to the generated images. Each URL corresponds to an image generated based on the provided prompt and parameters.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/d754e639-8955-43c1-a2b9-1ba4431950d2/b5aff034-3346-44be-8724-73f4feca789e.webp",
  "https://assets.cognitiveactions.com/invocations/d754e639-8955-43c1-a2b9-1ba4431950d2/100d3538-b73c-438b-b706-ca9a202510ed.webp",
  "https://assets.cognitiveactions.com/invocations/d754e639-8955-43c1-a2b9-1ba4431950d2/7f9d8f19-c167-4dec-8d8a-275e68e2b333.webp"
]

Conceptual Usage Example (Python)

Here's a conceptual example of how to use the Generate Images with LoRA action in 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 = "b998bd39-ff51-4885-a8ca-928052de2c78"  # Action ID for Generate Images with LoRA

# Construct the input payload based on the action's requirements
payload = {
    "width": 720,
    "goFast": False,
    "height": 1280,
    "prompt": "JUGO, a confident and beautiful woman with light auburn, wavy hair, standing in front of the brandenburger tor in germany with her arms crossed, wearing a figure-hugging, knee-length dress in a vibrant fuchsia tone with three-quarter sleeves. Her expression is warm and approachable, with a professional yet relaxed demeanor, captured in soft natural lighting that enhances the urban background, full-body, wide angle",
    "loraScale": 1,
    "modelType": "dev",
    "megapixels": "1",
    "guidanceScale": 2,
    "promptStrength": 0.8,
    "numberOfOutputs": 3,
    "imageAspectRatio": "9:16",
    "imageOutputFormat": "webp",
    "numInferenceSteps": 35,
    "imageOutputQuality": 100,
    "additionalLoraScale": 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 will need to replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action_id is set to the ID of the Generate Images with LoRA action. The payload is constructed based on the required input parameters. The response will contain the generated image URLs, which you can then use as needed.

Conclusion

The klassenmedia/jugo-flux-lora Cognitive Actions offer a powerful and flexible solution for developers looking to incorporate sophisticated image generation capabilities into their applications. By utilizing the Generate Images with LoRA action, you can create stunning visuals tailored to your specifications. As a next step, consider exploring different prompts and parameter combinations to optimize your image generation results. Happy coding!