Speed Up Your Image Generation with Modelo Campelo

25 Apr 2025
Speed Up Your Image Generation with Modelo Campelo

In the world of digital content creation, speed and quality are paramount. The "Modelo Campelo" service offers a powerful set of Cognitive Actions tailored specifically for image generation. Among its features is the ability to generate images with inpainting capabilities, allowing developers to create stunning visuals efficiently. These actions not only enhance workflow efficiency but also provide high-quality outputs through various customizable options.

Imagine needing to produce unique images for a marketing campaign, a website, or even a game. With Modelo Campelo, you can generate images quickly while maintaining the flexibility to fine-tune elements like prompt strength, aspect ratio, and output quality. This service is designed to cater to developers looking to streamline their creative processes while delivering compelling visual content.

Prerequisites

To get started with Modelo Campelo, you will need a Cognitive Actions API key and a basic understanding of how to make API calls.

Generate Image with Inpainting and Fast Mode

The "Generate Image with Inpainting and Fast Mode" action allows you to create images using an advanced inpainting model. This action is particularly useful for developers who require rapid image production without compromising quality. It leverages the 'schnell' model, which is optimized for speed, achieving results in just four inference steps.

Input Requirements

The input for this action includes a variety of parameters:

  • Prompt: A detailed description of the desired image (mandatory).
  • Mask: An optional image mask for inpainting.
  • Image: An optional input image for image-to-image transformations.
  • Model: Choose between the 'dev' model for detailed generation or the 'schnell' model for fast results.
  • Go Fast: A boolean option to enable the fast mode.
  • Aspect Ratio, Width, Height: Define the dimensions of the generated image, with specific constraints.
  • Output Count: Specify how many images to generate.
  • Output Format: Choose between webp, jpg, or png.
  • Guidance Scale: Adjust the influence of the prompt on the generated image.
  • Output Quality: Set the quality level of the output images.
  • Additional parameters for LoRA weights and safety checks.

Expected Output

The expected output is a generated image (or images) in the specified format, such as a URL link to the generated image file.

Use Cases for this Specific Action

  • Marketing Campaigns: Quickly produce unique visuals tailored to specific themes or products.
  • Game Development: Generate in-game assets that can be modified or refined using inpainting techniques.
  • Content Creation: Create engaging images for blogs, articles, or social media posts, enhancing visual appeal without the wait.

This action streamlines the image generation process, making it straightforward for developers to incorporate high-quality images into their projects with minimal time investment.


```python
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 = "c5b05bcc-2091-48b1-a9ce-ee6f5dfac032" # Action ID for: Generate Image with Inpainting and Fast Mode

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "model": "dev",
  "goFast": false,
  "prompt": "A person sitting on the floor against a white wall, wearing a white shirt over a white top and beige pants. The person has long dark hair and is accessorized with gold jewelry, including necklaces, bracelets, and rings. Next to them, a vase with dried pampas grass is placed on the floor, creating a soft and minimalist aesthetic",
  "aspectRatio": "1:1",
  "outputCount": 1,
  "outputFormat": "webp",
  "guidanceScale": 3,
  "outputQuality": 80,
  "promptStrength": 0.8,
  "inferenceStepCount": 28,
  "additionalLoraScale": 1,
  "loraAdjustmentScale": 1,
  "approximateMegapixels": "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
In summary, "Modelo Campelo" offers a sophisticated yet user-friendly approach to image generation, specifically with its inpainting capabilities. The ability to generate high-quality images quickly is a game-changer for developers across various industries. Whether you're creating marketing materials, developing games, or producing content, these Cognitive Actions can significantly enhance your workflow. 

To leverage these capabilities, start integrating the "Generate Image with Inpainting and Fast Mode" action into your projects today and experience the benefits of advanced image generation firsthand.