Generate Stunning Images with the s-clementc/manon Cognitive Action

23 Apr 2025
Generate Stunning Images with the s-clementc/manon Cognitive Action

In the realm of image generation, the s-clementc/manon Cognitive Actions offer a powerful solution for developers looking to create high-quality images through advanced techniques. The primary action focuses on image inpainting, allowing for customization of various attributes such as aspect ratio, resolution, and quality. By leveraging these pre-built actions, developers can save time and effort while achieving remarkable results in their applications.

Prerequisites

Before integrating the Cognitive Actions into your application, ensure that you have the following:

  • An API key for accessing the Cognitive Actions platform.
  • Basic knowledge of making HTTP requests and handling JSON data.

Authentication typically involves passing your API key in the request headers.

Cognitive Actions Overview

Generate Enhanced Image with Inpainting

The Generate Enhanced Image with Inpainting action allows you to create high-quality images using advanced inpainting techniques. You can choose between 'dev' and 'schnell' models, each optimized for speed and detail.

Input:

The input for this action is structured as follows:

{
  "prompt": "An ultra realistic image of Manon smiling looking at the camera",
  "modelType": "dev",
  "loraIntensity": 1,
  "aspectRatioType": "1:1",
  "numberOfOutputs": 4,
  "guidanceStrength": 3.5,
  "imageOutputFormat": "webp",
  "imageOutputQuality": 100,
  "additionalLoraScale": 0.8,
  "numberOfInferenceSteps": 28
}

Key Fields:

  • prompt (required): A descriptive string to guide the image generation.
  • modelType: Select between 'dev' or 'schnell' for the inference model.
  • aspectRatioType: The aspect ratio for the output image.
  • numberOfOutputs: Specifies how many images to generate.
  • guidanceStrength: Controls the influence of the prompt on the generation.

Output:

Upon successful execution, this action returns an array of image URLs in the specified format. Here is an example of the output:

[
  "https://assets.cognitiveactions.com/invocations/8d81e70e-a76b-450b-9d97-80026f28f669/f54fd529-e9f5-452d-9a4e-b899b756bbba.webp",
  "https://assets.cognitiveactions.com/invocations/8d81e70e-a76b-450b-9d97-80026f28f669/c596f07e-7085-48ef-846f-b381fde180f6.webp",
  "https://assets.cognitiveactions.com/invocations/8d81e70e-a76b-450b-9d97-80026f28f669/8c55a258-2a45-49cd-bb01-1b3b823ae8c7.webp",
  "https://assets.cognitiveactions.com/invocations/8d81e70e-a76b-450b-9d97-80026f28f669/1ad6ce6e-a9af-4525-9200-acd03bc48661.webp"
]

Conceptual Usage Example (Python):

Here’s how you might call the Generate Enhanced Image with Inpainting action within a Python application:

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 = "00ce18b0-3a57-44c1-a35f-96bb7d0b3b25"  # Action ID for Generate Enhanced Image with Inpainting

# Construct the input payload based on the action's requirements
payload = {
    "prompt": "An ultra realistic image of Manon smiling looking at the camera",
    "modelType": "dev",
    "loraIntensity": 1,
    "aspectRatioType": "1:1",
    "numberOfOutputs": 4,
    "guidanceStrength": 3.5,
    "imageOutputFormat": "webp",
    "imageOutputQuality": 100,
    "additionalLoraScale": 0.8,
    "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, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The payload variable is constructed according to the required input fields for the action. The endpoint and request structure are illustrative; you may need to adjust these based on the actual API specifications.

Conclusion

The s-clementc/manon Cognitive Action provides a robust solution for generating stunning images through advanced inpainting techniques. By integrating this action into your applications, you can enhance user experiences with high-quality visual content. Explore the different parameters to customize your image generation and consider experimenting with various prompts to achieve the best results. Happy coding!