Generate Stunning Images with the syyyone/yone Cognitive Actions

24 Apr 2025
Generate Stunning Images with the syyyone/yone Cognitive Actions

In the realm of artificial intelligence, generating high-quality images from textual prompts has become an exciting frontier. The syyyone/yone API offers a powerful Cognitive Action called Generate Enhanced Image, which allows developers to create detailed images with various customization options. This pre-built action simplifies the process of transforming text descriptions into stunning visuals, making it an invaluable tool for applications involving creative content, marketing, and more.

Prerequisites

To get started with the Cognitive Actions provided by the syyyone/yone API, you will need:

  • An API key for the Cognitive Actions platform.
  • Familiarity with JSON format for crafting input requests.
  • A basic understanding of making HTTP requests (conceptually, this will involve passing the API key in the request headers).

Authentication typically involves including your API key in the headers of your requests to the Cognitive Actions endpoint.

Cognitive Actions Overview

Generate Enhanced Image

The Generate Enhanced Image action allows you to create high-quality images based on provided text prompts. This action supports various features, including inpainting and image-to-image transformations, and offers different models tailored for detail and speed.

Input

The input schema for this action requires the following fields:

  • prompt (required): A textual description that guides the image generation.
  • model: Specifies the model for inference (dev for detail or schnell for speed).
  • goFast: A boolean to enable faster predictions.
  • imageAspectRatio: Defines the image's aspect ratio.
  • numberOfOutputs: Number of images to generate.
  • promptIntensity: Intensity of prompt influence.
  • guidanceMagnitude: Scale factor for guidance during the diffusion process.
  • imageOutputFormat: Desired format for the output images.
  • imageOutputQuality: Quality level for the saved images.
  • inferenceStepCount: Steps used for image denoising.

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

{
  "model": "dev",
  "goFast": false,
  "prompt": "A 39-year-old blonde woman named Yone is relaxing on a lounge chair on an exotic beach, with the ocean waves in the background. She is wearing a white long summer dress and smiling calmly, holding a glass of Champagne in her hand. The sun is setting in the sky, and the atmosphere is warm and soothing.\n\n",
  "imageMegapixels": "1",
  "numberOfOutputs": 4,
  "promptIntensity": 0.8,
  "imageAspectRatio": "1:1",
  "guidanceMagnitude": 3,
  "imageOutputFormat": "webp",
  "imageOutputQuality": 80,
  "inferenceStepCount": 28,
  "additionalLoraScale": 1,
  "loraApplicationScale": 1
}

Output

The action typically returns an array of image URLs, each pointing to a generated image. Here’s an example of what the output might look like:

[
  "https://assets.cognitiveactions.com/invocations/76722a78-7b4a-4055-83d1-62d0507a5863/26636b83-54e6-4981-8c8a-0cfec14097f9.webp",
  "https://assets.cognitiveactions.com/invocations/76722a78-7b4a-4055-83d1-62d0507a5863/85454789-d0bf-45c0-a491-7c7c1734aafa.webp",
  "https://assets.cognitiveactions.com/invocations/76722a78-7b4a-4055-83d1-62d0507a5863/f9965ec0-1b54-4dfb-bfa5-d371d8c88826.webp",
  "https://assets.cognitiveactions.com/invocations/76722a78-7b4a-4055-83d1-62d0507a5863/c039f975-618a-4bdb-ae3b-49b7f15a5b34.webp"
]

Conceptual Usage Example (Python)

Here’s a conceptual Python code snippet demonstrating how to call the Generate Enhanced Image action:

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 = "8a662a6a-daf0-4c01-8c49-e5c4e34023be"  # Action ID for Generate Enhanced Image

# Construct the input payload based on the action's requirements
payload = {
    "model": "dev",
    "goFast": False,
    "prompt": "A 39-year-old blonde woman named Yone is relaxing on a lounge chair on an exotic beach, with the ocean waves in the background. She is wearing a white long summer dress and smiling calmly, holding a glass of Champagne in her hand. The sun is setting in the sky, and the atmosphere is warm and soothing.\n\n",
    "imageMegapixels": "1",
    "numberOfOutputs": 4,
    "promptIntensity": 0.8,
    "imageAspectRatio": "1:1",
    "guidanceMagnitude": 3,
    "imageOutputFormat": "webp",
    "imageOutputQuality": 80,
    "inferenceStepCount": 28,
    "additionalLoraScale": 1,
    "loraApplicationScale": 1
}

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, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The payload variable is structured according to the input requirements specified for the action.

Conclusion

The Generate Enhanced Image Cognitive Action from the syyyone/yone API is a powerful tool for developers looking to integrate advanced image generation capabilities into their applications. By leveraging this action, you can create stunning visuals from text descriptions while customizing various parameters to suit your use case. Explore the potential of AI-driven imagery and consider how these capabilities can enhance your projects!