Enhance Your Application with Custom Image Generation Using maubad/pizzacalcetin

22 Apr 2025
Enhance Your Application with Custom Image Generation Using maubad/pizzacalcetin

In the realm of image processing and generation, the maubad/pizzacalcetin API offers a powerful set of Cognitive Actions that enable developers to create custom images through advanced inpainting techniques. These pre-built actions streamline the image generation process, allowing for various adjustments in resolution, quality, and style, making it an excellent choice for applications requiring dynamic and engaging visual content.

Prerequisites

To begin utilizing the Cognitive Actions provided by the maubad/pizzacalcetin API, you will need:

  • An API key from the Cognitive Actions platform, which will be used for authentication.
  • Basic knowledge of how to make API calls and handle JSON payloads.

Authentication typically involves passing your API key in the headers of your requests. This ensures secure access to the image generation functionalities offered by the API.

Cognitive Actions Overview

Generate Custom Image with Inpainting

The Generate Custom Image with Inpainting action is designed to create a customized image by applying inpainting techniques, allowing for intricate adjustments and transformations. This action supports image-to-image transformations and utilizes specific LoRA models for unique style invocation.

Input

The input for this action is structured as follows:

{
  "prompt": "Your image description here",
  "loraScale": 1,
  "numOutputs": 1,
  "aspectRatio": "1:1",
  "outputFormat": "webp",
  "guidanceScale": 3.5,
  "outputQuality": 90,
  "inferenceModel": "dev",
  "promptStrength": 0.8,
  "numInferenceSteps": 28,
  "additionalLoraScale": 1
}
  • Required Fields:
    • prompt: A detailed description guiding the image generation.
  • Optional Fields:
    • mask: URI for an image mask used in inpainting mode.
    • seed: Integer for setting a random seed.
    • image: URI for an input image used in image-to-image mode.
    • width: Specifies the width of the generated image.
    • height: Specifies the height of the generated image.
    • goFast: Enables faster predictions.
    • aspectRatio: Selects the aspect ratio for the generated image.
    • outputFormat: Specifies the image format for saving outputs.
    • customWeights: Loads LoRA weights from supported formats.
    • guidanceScale: Adjusts the guidance scale for realism.
    • outputQuality: Sets the quality for saved images.
    • inferenceModel: Selects the model for image inference.
    • promptStrength: Determines prompt strength in img2img mode.
    • numInferenceSteps: Specifies the number of denoising steps.
    • additionalLoraScale: Adjusts the strength of the additional LoRA.
    • disableSafetyChecker: Option to disable the safety checker.

Example Input

Here's an example JSON payload that you would send to invoke this action:

{
  "prompt": "pizzac A realistic image of a young woman wearing white socks with green and red stripes and a pizza slice design. She is styled in trendy streetwear fashion, wearing oversized clothing like a t-shirt or crop top, shorts, and sneakers. The scene is set in a skate park, with ramps, graffiti, and other skaters in the background. The lighting should be natural, capturing an energetic and urban vibe, while keeping the socks unchanged from the original design.",
  "loraScale": 1,
  "numOutputs": 1,
  "aspectRatio": "1:1",
  "outputFormat": "webp",
  "guidanceScale": 3.5,
  "outputQuality": 90,
  "inferenceModel": "dev",
  "promptStrength": 0.8,
  "numInferenceSteps": 28,
  "additionalLoraScale": 1
}

Output

Upon successful execution, the action typically returns a link to the generated image. For example:

[
  "https://assets.cognitiveactions.com/invocations/4852340f-2116-4036-8c5c-afdfbaab7ef5/4b52d465-84f5-4f87-8caf-61303e72e856.webp"
]

Conceptual Usage Example (Python)

Here’s how a developer might structure a call to 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 = "42509f6c-9279-47a4-b1d6-dfbba01a376f" # Action ID for Generate Custom Image with Inpainting

# Construct the input payload based on the action's requirements
payload = {
    "prompt": "pizzac A realistic image of a young woman wearing white socks with green and red stripes and a pizza slice design...",
    "loraScale": 1,
    "numOutputs": 1,
    "aspectRatio": "1:1",
    "outputFormat": "webp",
    "guidanceScale": 3.5,
    "outputQuality": 90,
    "inferenceModel": "dev",
    "promptStrength": 0.8,
    "numInferenceSteps": 28,
    "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}
    )
    response.raise_for_status()

    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 the above code:

  • Replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key.
  • The action_id is set to the ID of the image generation action.
  • The input payload is constructed based on the required fields.

Conclusion

The maubad/pizzacalcetin Cognitive Action for generating custom images with inpainting offers developers an exciting opportunity to enhance their applications with creative and personalized visuals. With adjustable parameters for quality, style, and output formats, this API provides the flexibility needed for a wide range of use cases. Start integrating these actions today to elevate the visual appeal of your applications!