Create Stunning Art with the vikrum/desi-truck-style Cognitive Actions

24 Apr 2025
Create Stunning Art with the vikrum/desi-truck-style Cognitive Actions

The vikrum/desi-truck-style API offers a powerful way for developers to generate vibrant and colorful images inspired by the unique desi truck art style. This set of Cognitive Actions allows for detailed control over various parameters during the image generation process, making it an excellent tool for artists, designers, and developers looking to add a creative touch to their applications. By leveraging pre-built actions, you can focus on building your application without needing to delve deeply into the complexities of image generation algorithms.

Prerequisites

To get started using the Cognitive Actions, you will need an API key from the Cognitive Actions platform. This key should be passed in the headers of your requests for authentication. Ensure that you have set up an environment where you can make HTTP requests, such as using Python's requests library.

Cognitive Actions Overview

Generate Desi Truck Art Style Image

The Generate Desi Truck Art Style Image action allows you to create images in the vibrant desi truck art style using a finetuned SDXL model. It supports both image-to-image transformations and inpainting, giving you extensive options to customize the output.

Input

The input schema for this action requires the following fields:

  • prompt (string): Describes the desired image features (e.g., "In the style of TOK, flying raven").
  • width (integer): Width of the output image in pixels (default: 1024).
  • height (integer): Height of the output image in pixels (default: 1024).
  • numOutputs (integer): Number of images to generate (1 to 4, default: 1).
  • guidanceScale (number): Scale for classifier-free guidance, ranging from 1 to 50 (default: 7.5).
  • numInferenceSteps (integer): Number of denoising steps during image generation (1 to 500, default: 50).
  • applyWatermark (boolean): If enabled, a watermark is applied to the image (default: true).
  • negativePrompt (string): Features to minimize in the generated image (e.g., "low quality, bad details").
  • promptStrength (number): Intensity of the prompt when using img2img or inpaint (0 to 1, default: 0.8).
  • loraScale (number): LoRA additive scale (0 to 1, default: 0.6).
  • scheduler (string): Scheduler type for the generation process (default: "K_EULER").

Here’s an example of the JSON payload to invoke this action:

{
  "width": 1024,
  "height": 1024,
  "prompt": "In the style of TOK, flying raven",
  "numOutputs": 1,
  "guidanceScale": 7.59,
  "numInferenceSteps": 16,
  "applyWatermark": false,
  "negativePrompt": "low quality, bad details, malformed, blurry",
  "promptStrength": 0.64,
  "loraScale": 0.92
}

Output

The action typically returns a URL pointing to the generated image. Here’s an example of the output:

[
  "https://assets.cognitiveactions.com/invocations/f3986599-2332-4218-85e6-fc1627da40ba/d2c91268-523e-4669-9ab2-6ff40fc37501.png"
]

Conceptual Usage Example (Python)

Here’s how you might call the Cognitive Actions execution endpoint 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 = "3b139647-5343-4592-9936-81aa2aeb261c"  # Action ID for Generate Desi Truck Art Style Image

# Construct the input payload based on the action's requirements
payload = {
    "width": 1024,
    "height": 1024,
    "prompt": "In the style of TOK, flying raven",
    "numOutputs": 1,
    "guidanceScale": 7.59,
    "numInferenceSteps": 16,
    "applyWatermark": False,
    "negativePrompt": "low quality, bad details, malformed, blurry",
    "promptStrength": 0.64,
    "loraScale": 0.92
}

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 the YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action ID is specific to the "Generate Desi Truck Art Style Image" action, and the payload is structured to include all necessary input parameters.

Conclusion

The vikrum/desi-truck-style Cognitive Actions provide a straightforward way for developers to create eye-catching images that embody the colorful and intricate designs of desi truck art. By utilizing the provided action, you can easily integrate unique visual content into your applications. Explore the various parameters to fine-tune your generated images and unleash your creativity!