Generate Stunning Gongbao Chicken Images with Cognitive Actions

24 Apr 2025
Generate Stunning Gongbao Chicken Images with Cognitive Actions

In today's digital landscape, the ability to generate high-quality images on demand can significantly enhance marketing strategies and online business presence. The peter65374/sdxl-gongbao specification offers a powerful Cognitive Action for generating custom images based on a specialized model trained on Gongbao chicken images. This action is particularly useful for businesses looking to create unique visuals for their products or promotional content.

Prerequisites

Before diving into the integration process, ensure you have the following:

  • An API key for the Cognitive Actions platform to authenticate your requests.
  • Familiarity with RESTful API concepts and JSON formatting.

To authenticate, you typically include your API key in the request headers, allowing access to the various Cognitive Actions available in the platform.

Cognitive Actions Overview

Generate Gongbao Chicken Images

This action allows developers to generate images using a fine-tuned sdxl 1.0 model, specifically designed for creating Gongbao chicken images. It is ideal for online marketing efforts and can produce visually appealing content to engage customers.

Input

The input for this action requires a JSON payload structured according to the following schema:

  • mask (string, optional): URI of the input mask for inpainting.
  • seed (integer, optional): Random seed for image generation.
  • image (string, optional): URI of the input image for img2img or inpainting modes.
  • width (integer, default: 1024): Width of the output image in pixels.
  • height (integer, default: 1024): Height of the output image in pixels.
  • prompt (string, default: "An astronaut riding a rainbow unicorn"): Text prompt for guiding image generation.
  • loraScale (number, default: 0.6): Scale factor for LoRA model adjustments.
  • numOutputs (integer, default: 1): Number of images to generate (1 to 4).
  • loraWeights (string, optional): Path or identifier for the LoRA weights.
  • refineSteps (integer, optional): Steps to refine the image.
  • refineStyle (string, default: "no_refiner"): Strategy for image refinement.
  • guidanceScale (number, default: 7.5): Control strength for classifier-free guidance.
  • highNoiseFrac (number, default: 0.8): Fraction of noise for expert ensemble refinement.
  • applyWatermark (boolean, default: true): Enables watermarking on generated images.
  • negativePrompt (string, optional): Text prompt indicating undesired features.
  • promptStrength (number, default: 0.8): Strength of the prompt's influence.
  • numInferenceSteps (integer, default: 50): Denoising steps during generation.
  • executionScheduler (string, default: "K_EULER"): Scheduling algorithm for image generation.
  • disableSafetyChecker (boolean, default: false): Disables the safety checker.

Here’s an example of a JSON payload that could be used to invoke this action:

{
  "width": 1024,
  "height": 1024,
  "prompt": "a photo of TOK plate on a cloth on the table",
  "loraScale": 0.8,
  "numOutputs": 2,
  "refineStyle": "no_refiner",
  "guidanceScale": 7.5,
  "highNoiseFrac": 0.8,
  "applyWatermark": false,
  "negativePrompt": "unrealistic, poor texture, poor quality, bad material, soft detail, bad pictures, (bad hand), ((low quality)), ((worst quality)), nsfw",
  "promptStrength": 0.8,
  "numInferenceSteps": 30,
  "executionScheduler": "K_EULER"
}

Output

Upon successfully executing the action, you will receive an array of image URLs, each pointing to a generated image. For example:

[
  "https://assets.cognitiveactions.com/invocations/3c3ef0d0-2755-407e-b8bd-43f2aac30316/cab314ba-4c61-418b-abbb-734716ca48f6.png",
  "https://assets.cognitiveactions.com/invocations/3c3ef0d0-2755-407e-b8bd-43f2aac30316/901c1d97-6273-4f8d-9edf-24fe9103128c.png"
]

Conceptual Usage Example (Python)

Here’s a conceptual Python code snippet demonstrating how to call this Cognitive 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 = "1450e9a2-d208-4526-9ae5-e0faae6a38fc" # Action ID for Generate Gongbao Chicken Images

# Construct the input payload based on the action's requirements
payload = {
    "width": 1024,
    "height": 1024,
    "prompt": "a photo of TOK plate on a cloth on the table",
    "loraScale": 0.8,
    "numOutputs": 2,
    "refineStyle": "no_refiner",
    "guidanceScale": 7.5,
    "highNoiseFrac": 0.8,
    "applyWatermark": False,
    "negativePrompt": "unrealistic, poor texture, poor quality, bad material, soft detail, bad pictures, (bad hand), ((low quality)), ((worst quality)), nsfw",
    "promptStrength": 0.8,
    "numInferenceSteps": 30,
    "executionScheduler": "K_EULER"
}

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 for the Generate Gongbao Chicken Images action.
  • The input payload is structured according to the schema provided earlier.

Conclusion

The Generate Gongbao Chicken Images Cognitive Action opens up new possibilities for businesses and developers looking to create visually appealing content efficiently. With customizable parameters, you can tailor the image output to meet your specific needs while leveraging the advanced capabilities of the sdxl model.

Explore the potential of these Cognitive Actions in your applications and take your digital content to the next level!