Design Custom Energy Drink Labels with Cognitive Actions for fofr/sdxl-energy-drink

22 Apr 2025
Design Custom Energy Drink Labels with Cognitive Actions for fofr/sdxl-energy-drink

In today's fast-paced beverage industry, having eye-catching packaging is crucial to capturing consumer attention. The fofr/sdxl-energy-drink API provides a powerful set of Cognitive Actions designed to generate stunning, custom energy drink labels. With pre-built actions that leverage advanced image generation models, developers can integrate unique designs directly into their applications, enhancing creativity and efficiency.

Prerequisites

To use the Cognitive Actions provided by the fofr/sdxl-energy-drink API, you'll need an API key. This key will authenticate your requests to the Cognitive Actions platform. When making HTTP requests, include your API key in the headers as follows:

Authorization: Bearer YOUR_COGNITIVE_ACTIONS_API_KEY

Cognitive Actions Overview

Design Custom Energy Drink Labels

The Design Custom Energy Drink Labels action allows you to create custom energy drink label designs using the SDXL model, fine-tuned for energy drink themes. This action provides high-quality, tailored outputs with options for inpainting, prompt customization, and refinement.

Input

The input schema for this action requires the following fields:

  • prompt (string): A text prompt guiding the image generation (e.g., "A photo of a TOK energy drinks can, Super Mario themed, white background").
  • width (integer): Width of the output image in pixels (default: 1024).
  • height (integer): Height of the output image in pixels (default: 1024).
  • refine (string): Selects the refinement style to be applied (default: "no_refiner").
  • loraScale (number): Scale for adding LoRA effects, applicable to trained models (default: 0.6).
  • scheduler (string): Choose the sampling scheduler for image generation (default: "K_EULER").
  • guidanceScale (number): Scale for classifier-free guidance (default: 7.5).
  • applyWatermark (boolean): Indicates whether a watermark should be applied (default: true).
  • negativePrompt (string): Input elements to avoid in the generated image.
  • promptStrength (number): Strength of the input prompt (default: 0.8).
  • numberOfOutputs (integer): Number of images to generate (default: 1, range: 1-4).
  • highNoiseFraction (number): Fraction of noise applied for refinement (default: 0.8).
  • numberOfInferenceSteps (integer): Number of denoising steps to refine the image (default: 50).

Example Input:

{
  "width": 1024,
  "height": 1024,
  "prompt": "A photo of a TOK energy drinks can, Super Mario themed, white background",
  "refine": "no_refiner",
  "loraScale": 0.6,
  "scheduler": "K_EULER",
  "guidanceScale": 7.5,
  "applyWatermark": false,
  "negativePrompt": "text, words,",
  "promptStrength": 0.8,
  "numberOfOutputs": 1,
  "highNoiseFraction": 0.8,
  "numberOfInferenceSteps": 25
}

Output

The action typically returns an array containing URLs of the generated images. For example:

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/6a5adc7a-fcbd-4758-8a68-cdcc011ed71b/443bf6b4-0fbc-40eb-a424-fbb7a73519f7.png"
]

Conceptual Usage Example (Python)

Here’s a conceptual Python code snippet demonstrating how to invoke the Design Custom Energy Drink Labels 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 = "32bdc5fa-97be-4284-8769-1fbf4bcefce8"  # Action ID for Design Custom Energy Drink Labels

# Construct the input payload based on the action's requirements
payload = {
    "width": 1024,
    "height": 1024,
    "prompt": "A photo of a TOK energy drinks can, Super Mario themed, white background",
    "refine": "no_refiner",
    "loraScale": 0.6,
    "scheduler": "K_EULER",
    "guidanceScale": 7.5,
    "applyWatermark": False,
    "negativePrompt": "text, words,",
    "promptStrength": 0.8,
    "numberOfOutputs": 1,
    "highNoiseFraction": 0.8,
    "numberOfInferenceSteps": 25
}

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 snippet, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action ID is specific to the Design Custom Energy Drink Labels action, and the input JSON payload is structured based on the provided example.

Conclusion

The fofr/sdxl-energy-drink Cognitive Actions empower developers to create unique and visually appealing energy drink labels effortlessly. By integrating these pre-built actions, you can enhance your applications' capabilities and streamline the design process. Whether you’re looking to automate label generation or explore creative design options, these actions provide a robust solution for your needs. Start implementing them in your applications today and take your beverage branding to the next level!