Create Stunning Images with the b3fr333/amara Cognitive Actions

23 Apr 2025
Create Stunning Images with the b3fr333/amara Cognitive Actions

In the ever-evolving landscape of image generation, the b3fr333/amara Cognitive Actions provide developers with powerful tools to create and modify images using advanced inpainting techniques. This set of pre-built actions allows for not only the generation of new images but also the transformation of existing ones, making it easier than ever for developers to integrate creative image solutions into their applications.

Prerequisites

Before diving into the Cognitive Actions, there are a few prerequisites to keep in mind:

  • API Key: You’ll need a valid API key to access the Cognitive Actions platform.
  • Setup: Ensure you have the necessary environment to make HTTP requests (e.g., Python with the requests library).
  • Authentication: Typically, authentication is managed by passing the API key in the request headers.

Cognitive Actions Overview

Generate Image with Inpainting

The Generate Image with Inpainting action is designed to create images using advanced inpainting techniques. This allows for detailed image outcomes and offers two models: the 'dev' model for quality and the 'schnell' model for speed. Developers can control various aspects of the image, including resolution, format, and quality, making it a versatile choice for image generation.

Input

The input for this action requires a JSON object with the following schema:

{
  "prompt": "string",
  "model": "string",
  "loraScale": "number",
  "outputFormat": "string",
  "guidanceScale": "number",
  "outputQuality": "integer",
  "extraLoraScale": "number",
  "promptStrength": "number",
  "numberOfOutputs": "integer",
  "imageAspectRatio": "string",
  "numberOfInferenceSteps": "integer"
}

Example Input:

{
  "model": "dev",
  "prompt": "AMARA sitting in a diner booth looking full of love",
  "loraScale": 1,
  "outputFormat": "jpg",
  "guidanceScale": 3.5,
  "outputQuality": 90,
  "extraLoraScale": 1,
  "promptStrength": 0.8,
  "numberOfOutputs": 1,
  "imageAspectRatio": "16:9",
  "numberOfInferenceSteps": 28
}

Output

Upon successful execution, this action returns a list of URLs pointing to the generated images. The output is typically structured as follows:

[
  "https://assets.cognitiveactions.com/invocations/d9b40997-22c2-4aa1-aa04-114de1b60a1a/6d27dbf9-65be-4b66-8e5b-7698fc241009.jpg"
]

Conceptual Usage Example (Python)

Here’s how a developer might invoke the Generate Image with Inpainting 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 = "2bbcb781-dd27-43bb-a3db-35ebaaf64479" # Action ID for Generate Image with Inpainting

# Construct the input payload based on the action's requirements
payload = {
    "model": "dev",
    "prompt": "AMARA sitting in a diner booth looking full of love",
    "loraScale": 1,
    "outputFormat": "jpg",
    "guidanceScale": 3.5,
    "outputQuality": 90,
    "extraLoraScale": 1,
    "promptStrength": 0.8,
    "numberOfOutputs": 1,
    "imageAspectRatio": "16:9",
    "numberOfInferenceSteps": 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} # Hypothetical structure
    )
    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, the developer is required to replace the API key and potentially adjust the endpoint URL. The input payload is structured to meet the action's requirements.

Conclusion

The b3fr333/amara Cognitive Actions offer an innovative way to generate and manipulate images using cutting-edge inpainting techniques. By leveraging these actions, developers can easily create stunning visuals tailored to their application's needs. Explore these capabilities further to enhance your projects with advanced image processing features. Happy coding!