Create Stunning Artwork with Bapu Style Image Generation Actions

23 Apr 2025
Create Stunning Artwork with Bapu Style Image Generation Actions

Introduction

The vkolagotla/bapubomma_ai API offers a remarkable Cognitive Action that allows developers to create images in the distinctive artistic style of the legendary Indian artist Bapu. This action leverages a fine-tuned version of the SDXL model, enabling users to generate artwork that pays tribute to Bapu's contributions to art and film. By utilizing this pre-built action, developers can effortlessly add creative image generation capabilities to their applications, enhancing user engagement and interaction.

Prerequisites

To get started with the Cognitive Actions, you will need an API key for the Cognitive Actions platform. This key is essential for authenticating your requests. Generally, authentication involves passing your API key as a bearer token in the request headers. Ensure you have a working environment set up to make HTTP requests, such as Python with the requests library.

Cognitive Actions Overview

Generate Bapu Style Image

The Generate Bapu Style Image action is designed to produce images that reflect the unique style of Bapu. This action is categorized under image-generation and provides a variety of input parameters to customize the generated artwork.

Input

The action accepts the following input parameters:

  • mask: (optional) A URI string for an input mask in inpaint mode, preserving black areas and inpainting white areas.
  • seed: (optional) An integer to set a random seed for image generation; leave blank for automatic randomization.
  • image: (optional) A URI string of an input image for Img2Img or Inpaint processing.
  • width: (optional) The width of the output image in pixels (default: 1024).
  • height: (optional) The height of the output image in pixels (default: 1024).
  • prompt: (required) A string that influences the scene and elements of the generated image.
  • refine: (optional) Specifies the refinement style (default: "no_refiner").
  • loraScale: (optional) A number that adjusts the LoRA scale (default: 0.6).
  • scheduler: (optional) The algorithm for managing the diffusion process (default: "K_EULER").
  • loraWeights: (optional) The weights for LoRA; leave blank for defaults.
  • guidanceScale: (optional) A number affecting the creativity and focus of generation (default: 7.5).
  • applyWatermark: (optional) A boolean to add a watermark to the image (default: true).
  • negativePrompt: (optional) A string to specify undesired elements in the image.
  • promptStrength: (optional) A number indicating the influence of the prompt (default: 0.8).
  • numberOfOutputs: (optional) The number of images to generate (default: 1).
  • refinementSteps: (optional) The number of steps for refinement.
  • highNoiseFraction: (optional) Fraction of noise for the expert ensemble refiner (default: 0.8).
  • disableSafetyChecker: (optional) Turns off the safety checker for image generation (default: false).
  • numberOfInferenceSteps: (optional) Total denoising steps in the image generation process (default: 50).

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

{
  "width": 512,
  "height": 512,
  "prompt": "bapubomma, artistic illustration, Create art of a Young indian woman surrounded by dark duotone vertical textures glitch image, dramatic and bold contrasts. Incorporate a hint of sepia for a vintage feel",
  "refine": "no_refiner",
  "loraScale": 0.9,
  "scheduler": "K_EULER",
  "guidanceScale": 7.5,
  "applyWatermark": true,
  "negativePrompt": "face and body deformities, abnormal human structure, abnormal shapes and structures, non-artistic illustrations",
  "promptStrength": 0.8,
  "numberOfOutputs": 1,
  "highNoiseFraction": 0.8,
  "numberOfInferenceSteps": 100
}

Output

Upon successful execution, the action typically returns a list of URLs pointing to the generated images. Here is an example of a potential output:

[
  "https://assets.cognitiveactions.com/invocations/64b6b252-fd32-4d77-bd6b-f63e78a13d87/1d91e75a-2a42-46a2-8955-677591079952.png"
]

Conceptual Usage Example (Python)

Below is a conceptual Python code snippet demonstrating how to call this action through a hypothetical Cognitive Actions execution endpoint:

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 = "b97b3269-274b-4b52-87ff-f1ec6c0b9e35"  # Action ID for Generate Bapu Style Image

# Construct the input payload based on the action's requirements
payload = {
    "width": 512,
    "height": 512,
    "prompt": "bapubomma, artistic illustration, Create art of a Young indian woman surrounded by dark duotone vertical textures glitch image, dramatic and bold contrasts. Incorporate a hint of sepia for a vintage feel",
    "refine": "no_refiner",
    "loraScale": 0.9,
    "scheduler": "K_EULER",
    "guidanceScale": 7.5,
    "applyWatermark": True,
    "negativePrompt": "face and body deformities, abnormal human structure, abnormal shapes and structures, non-artistic illustrations",
    "promptStrength": 0.8,
    "numberOfOutputs": 1,
    "highNoiseFraction": 0.8,
    "numberOfInferenceSteps": 100
}

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}
    )
    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, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action ID and input payload are structured to match the requirements of the Generate Bapu Style Image action.

Conclusion

The vkolagotla/bapubomma_ai API provides a powerful tool for generating unique artistic images inspired by Bapu's style. By integrating this action into your applications, you can offer users a creative outlet that celebrates Indian art and culture. Explore various prompts, styles, and configurations to unleash the full potential of image generation in your projects!