Enhance Your Applications with Sunday-Film Minta-Character Cognitive Actions

22 Apr 2025
Enhance Your Applications with Sunday-Film Minta-Character Cognitive Actions

Integrating advanced image generation capabilities into your applications has never been easier, thanks to the Sunday-Film Minta-Character Cognitive Actions. This set of pre-built actions provides developers with powerful tools to create stunning visuals through image inpainting and customization options. By leveraging these actions, you can enhance user experiences, automate creative processes, and produce high-quality images tailored to specific needs.

Prerequisites

Before diving into the integration of Cognitive Actions, ensure you have the following:

  • API Key: You will need a valid API key for the Cognitive Actions platform.
  • Basic Setup: Familiarity with making HTTP requests and handling JSON payloads in your application.

Authentication typically involves passing the API key in the request headers, allowing you to securely access the Cognitive Actions services.

Cognitive Actions Overview

Generate Image with Inpainting

The Generate Image with Inpainting action allows you to create images using predictive models. This action supports image-to-image translation and inpainting, providing customization options for image size, quality, and style.

Input

The input schema for this action requires a prompt, which is essential for generating the image. Additionally, it includes several optional fields for further customization:

{
  "prompt": "araminta character carrying a paper bag full of groceries, walking down a european street, pink sweater, jeans, sneakers, illustration style",
  "model": "dev",
  "extraLora": "sunday-film/tiny-life",
  "loraScale": 0.8,
  "imageFormat": "png",
  "outputCount": 4,
  "guidanceScale": 3.5,
  "outputQuality": 90,
  "extraLoraScale": 1,
  "promptStrength": 0.8,
  "imageAspectRatio": "9:16",
  "inferenceStepCount": 28
}

Output

Upon successful execution, this action returns a list of image URLs in the specified format. Here’s an example of the output:

[
  "https://assets.cognitiveactions.com/invocations/3b09cdeb-ab71-4c22-9708-d781b82aaa26/b9229e61-bd24-4da7-8ab0-84f8c0efafad.png",
  "https://assets.cognitiveactions.com/invocations/3b09cdeb-ab71-4c22-9708-d781b82aaa26/02e88fcc-adba-40ff-a4b1-d07ba24a694a.png",
  "https://assets.cognitiveactions.com/invocations/3b09cdeb-ab71-4c22-9708-d781b82aaa26/6149eced-8419-4d2d-822b-280a9f6989af.png",
  "https://assets.cognitiveactions.com/invocations/3b09cdeb-ab71-4c22-9708-d781b82aaa26/89c9773d-5ca1-4618-9235-e6803fba69cd.png"
]

Conceptual Usage Example (Python)

Here’s how you might call 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 = "751a438a-ecb0-4867-a569-2299e8411130"  # Action ID for Generate Image with Inpainting

# Construct the input payload based on the action's requirements
payload = {
    "prompt": "araminta character carrying a paper bag full of groceries, walking down a european street, pink sweater, jeans, sneakers, illustration style",
    "model": "dev",
    "extraLora": "sunday-film/tiny-life",
    "loraScale": 0.8,
    "imageFormat": "png",
    "outputCount": 4,
    "guidanceScale": 3.5,
    "outputQuality": 90,
    "extraLoraScale": 1,
    "promptStrength": 0.8,
    "imageAspectRatio": "9:16",
    "inferenceStepCount": 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 example, replace "YOUR_COGNITIVE_ACTIONS_API_KEY" with your actual API key. The payload object is structured according to the action's requirements, and the request is made to the hypothetical endpoint for execution.

Conclusion

The Sunday-Film Minta-Character Cognitive Actions provide developers with robust tools for image generation, allowing for creativity and customization in application development. By utilizing the Generate Image with Inpainting action, you can seamlessly integrate advanced image generation capabilities into your applications, enhancing user engagement and satisfaction. Consider exploring further use cases or combining this action with other functionalities to create unique experiences.