Generate Stunning Images with the bianutri1407/modelo_bia Cognitive Actions

23 Apr 2025
Generate Stunning Images with the bianutri1407/modelo_bia Cognitive Actions

In the world of artificial intelligence, the ability to generate and manipulate images has become increasingly powerful and accessible. One such innovation comes from the bianutri1407/modelo_bia, offering a set of Cognitive Actions that allow developers to create customized images using advanced techniques like inpainting and image-to-image modifications. These pre-built actions simplify the process of image generation, enabling you to focus on building amazing applications without delving into the complexities of machine learning models.

Prerequisites

Before you get started with the bianutri1407/modelo_bia Cognitive Actions, ensure you have the following:

  • An API key for the Cognitive Actions platform, which you will use to authenticate your requests.
  • Basic knowledge of JSON and familiarity with making HTTP requests, as you will be interacting with an API endpoint.

For authentication, you will typically include your API key in the request headers like so:

Authorization: Bearer YOUR_COGNITIVE_ACTIONS_API_KEY

Cognitive Actions Overview

Generate Image with Model Bia

The Generate Image with Model Bia action allows you to create unique images based on detailed textual prompts. This action supports various options for image dimensions, quality, and formats, making it flexible for different use cases.

Input

The input for this action is structured as follows:

  • prompt (required): A detailed description of the image you want to generate.
  • mask (optional): An image mask for inpainting mode.
  • seed (optional): A specific random seed to ensure reproducible results.
  • image (optional): An input image for image-to-image or inpainting mode.
  • width (optional): Width of the generated image in pixels (applicable when aspect_ratio is set to custom).
  • height (optional): Height of the generated image in pixels (applicable when aspect_ratio is set to custom).
  • goFast (optional): Enable fast generation mode.
  • aspectRatio (optional): Select the aspect ratio for the generated image.
  • numOutputs (optional): Specifies the number of images to generate (1 to 4).
  • outputFormat (optional): Desired file format for the output (webp, jpg, png).
  • guidanceScale (optional): Controls the guide intensity during the diffusion process.
  • outputQuality (optional): Defines the quality level for the generated images.
  • promptStrength (optional): Determines the prompt's impact when using img2img.
  • numInferenceSteps (optional): Count of denoising steps.

Here’s a practical example of the JSON payload needed to invoke this action:

{
  "goFast": false,
  "prompt": "model_bia Person's position: Woman sitting facing forward, slightly leaning in, with a soft expression and a gentle smile on her lips.\n\nFace: Slightly tilted to her left side, looking directly at the camera. Calm and welcoming expression, with a slimmer face shape.\n\nHair: Blonde with highlights, slightly wavy, parted in the middle, half-up hairstyle flowing over the shoulders. Hair is slightly longer than average, adding elegance to the look.\n\nOutfit: Fitted sleeveless top in a light beige/nude tone, paired with high-waisted white pants with an integrated belt.\n\nAccessories: Discreet wristwatch on the left arm and small earrings.\n\nBackground: Plain light gray background with no objects or distractions.\n\nLighting: Soft, diffused light highlighting the contours of the face and hair, without harsh shadows.",
  "loraScale": 1,
  "modelType": "dev",
  "numOutputs": 1,
  "aspectRatio": "16:9",
  "outputFormat": "png",
  "guidanceScale": 3,
  "outputQuality": 80,
  "extraLoraScale": 1,
  "promptStrength": 0.8,
  "approxMegapixels": "1",
  "numInferenceSteps": 28
}

Output

When you successfully execute this action, it typically returns a URL pointing to the generated image. Here is an example of what the output might look like:

[
  "https://assets.cognitiveactions.com/invocations/bbf970a6-bfe9-4e32-a806-28cfb6641bd5/9665f936-ed74-40ca-a77c-741b42b010a8.png"
]

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 = "7008fe66-06f9-4f9c-a4f0-2c28193ac049"  # Action ID for Generate Image with Model Bia

# Construct the input payload based on the action's requirements
payload = {
    "goFast": False,
    "prompt": "model_bia Person's position: Woman sitting facing forward, slightly leaning in, with a soft expression and a gentle smile on her lips.\n\nFace: Slightly tilted to her left side, looking directly at the camera. Calm and welcoming expression, with a slimmer face shape.\n\nHair: Blonde with highlights, slightly wavy, parted in the middle, half-up hairstyle flowing over the shoulders. Hair is slightly longer than average, adding elegance to the look.\n\nOutfit: Fitted sleeveless top in a light beige/nude tone, paired with high-waisted white pants with an integrated belt.\n\nAccessories: Discreet wristwatch on the left arm and small earrings.\n\nBackground: Plain light gray background with no objects or distractions.\n\nLighting: Soft, diffused light highlighting the contours of the face and hair, without harsh shadows.",
    "loraScale": 1,
    "modelType": "dev",
    "numOutputs": 1,
    "aspectRatio": "16:9",
    "outputFormat": "png",
    "guidanceScale": 3,
    "outputQuality": 80,
    "extraLoraScale": 1,
    "promptStrength": 0.8,
    "approxMegapixels": "1",
    "numInferenceSteps": 28
}

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 this code, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action ID and input payload are structured correctly to match the requirements of the Generate Image with Model Bia action. This example focuses on conceptual usage; the actual endpoint and request structure may vary.

Conclusion

The bianutri1407/modelo_bia Cognitive Actions empower developers to create stunning images with ease. By leveraging the Generate Image with Model Bia action, you can produce customized visuals tailored to your application's needs, enhancing user engagement and creativity. Whether you're building a content creation tool, an art application, or anything in between, these actions provide a robust foundation for your image generation needs. Start experimenting with the action today and unlock the potential of AI-driven image creation!