Create Stunning Images with Custom Inpainting Using Liana Br

25 Apr 2025
Create Stunning Images with Custom Inpainting Using Liana Br

In today's digital landscape, the ability to generate and enhance images quickly and effectively is a game-changer for developers and artists alike. With the Liana Br Cognitive Actions, you can harness the power of AI to create visually stunning images through advanced techniques like custom inpainting. This service simplifies the process of image generation, allowing you to adjust parameters such as image size, aspect ratio, and output format effortlessly.

Imagine crafting unique visuals for your projects, be it for marketing materials, game design, or social media content. Liana Br not only speeds up your workflow but also enhances creativity by providing the tools to produce high-quality images tailored to your specific needs. Whether you want to generate entirely new images or transform existing ones, the possibilities are endless.

Prerequisites

To get started with Liana Br, you'll need an API key for Cognitive Actions and a basic understanding of API calls. This will allow you to integrate the image generation capabilities into your applications seamlessly.

Generate Image with Custom Inpainting

The Generate Image with Custom Inpainting action allows you to utilize either the 'dev' or 'schnell' model to create and enhance images through custom inpainting. This action is particularly useful for developers looking to add unique elements to existing images or generate entirely new visuals based on descriptive prompts.

Purpose

This action addresses the challenge of producing high-quality, customized images that meet specific design criteria. By leveraging advanced features such as LoRA weights and prompt strength, you can achieve impressive results that align with your creative vision.

Input Requirements

To use this action, you need to provide several inputs:

  • Prompt: A descriptive text input that guides the image generation.
  • Model: Choose between 'dev' for optimal performance or 'schnell' for faster results.
  • Image/Mask: Optionally provide a URI for an input image or a mask for inpainting.
  • Aspect Ratio, Width, Height: Specify these parameters if not using an input image.
  • Additional parameters include seed for reproducibility, output format, guidance scale, and more.

Expected Output

The output will consist of generated images based on your specifications, returned in the format you choose (e.g., webp, jpg, png). You can expect multiple image outputs depending on your settings.

Use Cases for this Action

  • Creative Content Creation: Perfect for artists and designers looking to generate unique images for their portfolios or projects.
  • Marketing and Advertising: Quickly produce visuals tailored for campaigns without the need for extensive graphic design resources.
  • Game Development: Create custom assets and backgrounds that enhance the visual appeal of your game.
  • Social Media: Generate eye-catching images that stand out in feeds, helping to boost engagement.
import requests
import json

# Replace with your actual Cognitive Actions API key and endpoint
# Ensure your environment securely handles the API key
COGNITIVE_ACTIONS_API_KEY = "YOUR_COGNITIVE_ACTIONS_API_KEY"
# This endpoint URL is hypothetical and should be documented for users
COGNITIVE_ACTIONS_EXECUTE_URL = "https://api.cognitiveactions.com/actions/execute"

action_id = "9c2fd5ce-d450-48ae-b8c1-d941318c4fbb" # Action ID for: Generate Image with Custom Inpainting

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "model": "schnell",
  "prompt": "mid shot of liana-br, a 20-year old bangladeshi girl dressed casually in a light cardigan over a green top and dark trousers. She has a brown side bag. She is pouring a glass of water in a glass standing inside the dining room in a Bangladeshi house, 2d animation style. ",
  "fastMode": false,
  "megapixels": "1",
  "aspectRatio": "16:9",
  "outputFormat": "webp",
  "guidanceScale": 3,
  "loraIntensity": 1,
  "promptStrength": 0.8,
  "numberOfOutputs": 2,
  "imageOutputQuality": 80,
  "inferenceStepsCount": 28,
  "additionalLoraIntensity": 1
}

headers = {
    "Authorization": f"Bearer {COGNITIVE_ACTIONS_API_KEY}",
    "Content-Type": "application/json",
    # Add any other required headers for the Cognitive Actions API
}

# Prepare the request body for the hypothetical execution endpoint
request_body = {
    "action_id": action_id,
    "inputs": payload
}

print(f"--- Calling Cognitive Action: {action.name or action_id} ---")
print(f"Endpoint: {COGNITIVE_ACTIONS_EXECUTE_URL}")
print(f"Action ID: {action_id}")
print("Payload being sent:")
print(json.dumps(request_body, indent=2))
print("------------------------------------------------")

try:
    response = requests.post(
        COGNITIVE_ACTIONS_EXECUTE_URL,
        headers=headers,
        json=request_body
    )
    response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx)

    result = response.json()
    print("Action executed successfully. Result:")
    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 (non-JSON): {e.response.text}")
    print("------------------------------------------------")

Conclusion

Liana Br's custom inpainting capabilities empower developers and creatives to generate stunning visuals efficiently. With its user-friendly API and customizable parameters, you can enhance your projects and bring your ideas to life like never before. Start experimenting with Liana Br today and unlock new levels of creativity in your work!