Create Stunning Eurovision Singer Images with the Eurotok Cognitive Actions

24 Apr 2025
Create Stunning Eurovision Singer Images with the Eurotok Cognitive Actions

Introduction

The Eurotok Cognitive Actions offer developers a powerful way to generate unique images of Eurovision singers using an advanced AI model trained specifically on Eurovision-related data. These pre-built actions simplify the process of image generation, enabling customization through various parameters to enhance both the quality and relevance of the generated images. By leveraging these Cognitive Actions, developers can easily integrate creative image generation capabilities into their applications.

Prerequisites

Before diving into the integration, ensure you have the necessary setup:

  • API Key: You will need an API key for accessing the Eurotok Cognitive Actions platform.
  • Basic Setup: Familiarity with making HTTP requests and handling JSON data in your chosen programming language.

For authentication, you will typically include your API key in the request headers, allowing you to securely access the Cognitive Actions.

Cognitive Actions Overview

Generate Eurovision Singer Image

The Generate Eurovision Singer Image action allows developers to create images of Eurovision singers based on a descriptive prompt. This action provides a variety of customization options, enabling users to control aspects such as image dimensions, refinement styles, and guidance scales.

Input

The input for this action consists of several parameters, defined in the schema as follows:

  • mask: (string, optional) URI of the input mask for inpainting.
  • seed: (integer, optional) Random seed for generating output.
  • image: (string, optional) URI of the input image for transformations.
  • width: (integer, default: 1024) Width in pixels of the output image.
  • height: (integer, default: 1024) Height in pixels of the output image.
  • prompt: (string, default: "An astronaut riding a rainbow unicorn") Descriptive text to guide the image generation.
  • refineStyle: (string, default: "no_refiner") Refinement method for enhancing image output.
  • applyWatermark: (boolean, default: true) Enables watermarking on generated images.
  • numberOfOutputs: (integer, default: 1, min: 1, max: 4) Number of images to generate.
  • freeGuidanceScale: (number, default: 7.5) Strength of classifier-free guidance during generation.
  • highNoiseFraction: (number, default: 0.8) Fraction of noise for refinement.
  • loraAdditiveScale: (number, default: 0.6) Scale for the LoRA additive effect.
  • inputPromptStrength: (number, default: 0.8) Controls the strength of the prompt influence.
  • negativeInputPrompt: (string, default: "") Descriptor to avoid in the image.
  • schedulingAlgorithm: (string, default: "K_EULER") Algorithm for image generation schedule.
  • numberOfDenoisingSteps: (integer, default: 50, min: 1, max: 500) Steps for denoising.
  • deactivateSafetyChecker: (boolean, default: false) Disables the safety check for generated images.
  • numberOfRefinementSteps: (integer, optional) Number of steps for refinement.

Example Input:

{
  "width": 1024,
  "height": 1024,
  "prompt": "A photograph of a EurovisionTOK Donald Trump singing in a beautiful dress",
  "refineStyle": "no_refiner",
  "applyWatermark": true,
  "numberOfOutputs": 1,
  "freeGuidanceScale": 7.5,
  "highNoiseFraction": 0.8,
  "loraAdditiveScale": 0.94,
  "inputPromptStrength": 0.8,
  "negativeInputPrompt": "hands",
  "schedulingAlgorithm": "K_EULER",
  "numberOfDenoisingSteps": 50
}

Output

Upon successful execution, the action returns a URL pointing to the generated image.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/8669ce66-2211-4a8d-b2f3-60919a6ef8e7/4d1412eb-db86-475b-a161-89e74c8985c5.png"
]

Conceptual Usage Example (Python)

Here’s how you might invoke the Generate Eurovision Singer Image 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 = "644642f0-ac97-457e-b7f9-d6226a6b7996"  # Action ID for Generate Eurovision Singer Image

# Construct the input payload based on the action's requirements
payload = {
    "width": 1024,
    "height": 1024,
    "prompt": "A photograph of a EurovisionTOK Donald Trump singing in a beautiful dress",
    "refineStyle": "no_refiner",
    "applyWatermark": True,
    "numberOfOutputs": 1,
    "freeGuidanceScale": 7.5,
    "highNoiseFraction": 0.8,
    "loraAdditiveScale": 0.94,
    "inputPromptStrength": 0.8,
    "negativeInputPrompt": "hands",
    "schedulingAlgorithm": "K_EULER",
    "numberOfDenoisingSteps": 50
}

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 action ID and input payload are structured according to the specifications, making it easy to generate stunning Eurovision images.

Conclusion

The Eurotok Cognitive Actions provide developers with a flexible and powerful means to generate creative images tailored to the Eurovision theme. By utilizing the Generate Eurovision Singer Image action, you can easily enhance your applications with unique visual content. Explore the various parameters available to customize the output to your specific needs and start building engaging experiences today!