Create Personalized Images with Nestlé Flux Drumstick Cognitive Actions

22 Apr 2025
Create Personalized Images with Nestlé Flux Drumstick Cognitive Actions

Integrating advanced image generation capabilities into your applications has never been easier with the Nestlé Flux Drumstick Cognitive Actions. This powerful set of Cognitive Actions allows developers to generate custom images based on a variety of settings, including image masks, random seeds, and guidance scales. With a focus on personalization and enhanced realism, these actions can help bring your creative ideas to life.

Prerequisites

Before you begin using the Nestlé Flux Drumstick Cognitive Actions, ensure you have the following:

  • An API key for accessing the Cognitive Actions platform.
  • Familiarity with JSON for structuring input and handling output.
  • A basic understanding of HTTP requests.

For authentication, you will typically pass the API key in the request headers when making calls to the Cognitive Actions endpoint.

Cognitive Actions Overview

Generate Mini-Me Images

Description:
This action creates personalized mini-me images using a variety of settings, including image masks, random seeds, guidance scales, and output quality. You can utilize features like prompt strength and LoRA applications for enhanced realism and customization.

Category: Image Generation

Input

The input schema for this action requires the following fields:

  • prompt (required): A description of the desired image.
  • image (optional): An input image for image-to-image or inpainting mode.
  • mask (optional): An image mask for inpainting mode.
  • width and height (optional): Dimensions of the generated image in pixels.
  • imageFormat (optional): Format of the output image (webp, jpg, png).
  • imageQuality (optional): Quality level of output images (0-100).
  • guidanceScale (optional): Scale of guidance during the diffusion process (0-10).
  • loraIntensity (optional): Intensity of the main LoRA application (0-3).
  • inferenceModel (optional): Select model for image inference (dev or schnell).
  • numberOfOutputs (optional): Number of output images (1-4).
  • additionalLoraScale (optional): Intensity for additional LoRA (0-3).
  • safetyCheckDisabled (optional): Option to disable safety checks.

Here’s an example input JSON payload:

{
  "image": "https://replicate.delivery/pbxt/Lfoo9Tfpe6tfqSKGkZpkPin2f18W8MTR7nXAYAMJUJyb1f90/Screenshot%202024-09-23%20at%2015.50.02.png",
  "prompt": "a 7 year old DRMSTCK child, 7 year old girl, front view, in front of a wallpaper with icecream illustrations",
  "imageFormat": "webp",
  "imageQuality": 90,
  "guidanceScale": 3.5,
  "loraIntensity": 1,
  "inferenceModel": "dev",
  "inferenceSteps": 28,
  "numberOfOutputs": 1,
  "promptIntensity": 0.8,
  "imageAspectRatio": "1:1",
  "additionalLoraScale": 1
}

Output

The action typically returns a URL to the generated image. The output might look like this:

[
  "https://assets.cognitiveactions.com/invocations/cc92b8b9-3172-46c1-8789-065beb01799d/f7375aa0-48e8-4853-9758-5f7a058cb2f1.webp"
]

Conceptual Usage Example (Python)

Here’s a conceptual Python code snippet demonstrating how to call the Cognitive Actions execution endpoint for generating mini-me images:

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 = "c879f955-d655-4374-9c98-11fe205f8334" # Action ID for Generate Mini-Me Images

# Construct the input payload based on the action's requirements
payload = {
    "image": "https://replicate.delivery/pbxt/Lfoo9Tfpe6tfqSKGkZpkPin2f18W8MTR7nXAYAMJUJyb1f90/Screenshot%202024-09-23%20at%2015.50.02.png",
    "prompt": "a 7 year old DRMSTCK child, 7 year old girl, front view, in front of a wallpaper with icecream illustrations",
    "imageFormat": "webp",
    "imageQuality": 90,
    "guidanceScale": 3.5,
    "loraIntensity": 1,
    "inferenceModel": "dev",
    "inferenceSteps": 28,
    "numberOfOutputs": 1,
    "promptIntensity": 0.8,
    "imageAspectRatio": "1:1",
    "additionalLoraScale": 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 snippet:

  • Replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key.
  • The action_id is set to the ID of the "Generate Mini-Me Images" action.
  • The payload is constructed according to the requirements of the action.

Conclusion

The Nestlé Flux Drumstick Cognitive Actions offer developers a robust solution for generating personalized images with a high degree of customization. By leveraging these actions, you can enhance your applications with unique visual content tailored to your users' needs. Explore the various parameters to fine-tune your image generation and start creating today!