Create Stunning Custom Images with jarvis-labs2024 Cognitive Actions

24 Apr 2025
Create Stunning Custom Images with jarvis-labs2024 Cognitive Actions

In the world of image generation, the jarvis-labs2024/console_cowboy_flux API provides powerful Cognitive Actions that allow developers to create custom images tailored to specific needs. Whether you’re looking to transform existing images, generate new visuals from scratch, or explore creative prompts, these pre-built actions streamline your workflow, enabling rapid development of rich visual content.

Prerequisites

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

  • An API key for the Cognitive Actions platform.
  • Basic understanding of JSON structures and HTTP requests.
  • Familiarity with Python for executing example code snippets.

Authentication typically involves passing your API key in the request headers, which will allow you to access the Cognitive Actions seamlessly.

Cognitive Actions Overview

Generate Custom Images

Purpose

The Generate Custom Images action allows developers to create customized images using various input parameters, such as image masks, aspect ratios, and prompt intensities. This action supports both image-to-image transformations and inpainting modes, making it versatile for a range of creative applications.

Input

The input for this action requires a structured JSON object. Here’s a breakdown of the fields:

  • Required:
    • prompt: The textual description guiding the image generation.
  • Optional:
    • mask: Image mask for inpainting mode (ignores width, height).
    • seed: Random seed for reproducible outputs.
    • image: Input image for transformations (overrides width, height).
    • model: Select inference model, either "dev" or "schnell".
    • width: Width of the generated image (only for custom aspect ratio).
    • height: Height of the generated image (only for custom aspect ratio).
    • fastMode: Enable faster predictions with a speed-optimized model.
    • loraScale: Adjusts strength of the main LoRA application.
    • megapixels: Approximate number of megapixels for the image.
    • aspectRatio: Aspect ratio of the generated image.
    • imageFormat: Format of the output image files (e.g., webp, jpg, png).
    • imageQuality: Quality level for saving output images.
    • modelWeights: Load LoRA weights from specified sources.
    • guidanceScale: Parameter for the diffusion process.
    • additionalLora: Load additional LoRA weights.
    • inferenceSteps: Number of denoising steps for generation.
    • numberOfImages: Number of images to generate.
    • promptStrength: Strength of prompt influence for img2img.
    • additionalLoraScale: Strength of additional LoRA application.
    • disableSafetyChecker: Option to disable the safety checker for images.

Example Input:

{
  "model": "dev",
  "prompt": "a man riding Tokyo cyber jet bike, retro 1990, dark background, SOK",
  "loraScale": 1,
  "aspectRatio": "1:1",
  "imageFormat": "webp",
  "imageQuality": 80,
  "guidanceScale": 3.5,
  "inferenceSteps": 28,
  "numberOfImages": 1
}

Output

The action typically returns a JSON array containing URLs to the generated images. For example:

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/ee851fd4-d9cc-4827-9131-38df81cd79d0/0a5d63fa-ddec-4c02-bd2d-c89db4dd8b40.webp"
]

Conceptual Usage Example (Python)

Here’s how you might call this 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 = "e803fe5c-ebea-47d2-8721-9729fc4bbd91"  # Action ID for Generate Custom Images

# Construct the input payload based on the action's requirements
payload = {
    "model": "dev",
    "prompt": "a man riding Tokyo cyber jet bike, retro 1990, dark background, SOK",
    "loraScale": 1,
    "aspectRatio": "1:1",
    "imageFormat": "webp",
    "imageQuality": 80,
    "guidanceScale": 3.5,
    "inferenceSteps": 28,
    "numberOfImages": 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 example, replace "YOUR_COGNITIVE_ACTIONS_API_KEY" with your actual API key. The payload object is structured based on the required input schema, and the action ID is specified to invoke the correct Cognitive Action.

Conclusion

The jarvis-labs2024/console_cowboy_flux Cognitive Actions provide a powerful toolkit for image generation, allowing developers to easily create stunning visuals with custom parameters. By leveraging these actions, you can streamline your image generation processes, explore creative possibilities, and enhance your applications with unique content. Start integrating these actions today and unleash your creativity in image creation!