Create Unique Chibi Face Stickers with Cognitive Actions for Image Generation

Cognitive Actions under the spec titled dev-pbg/chibi-face-stickers empower developers to create custom chibi-style face stickers from input images. This service enables a range of customizable parameters, making it easy to generate high-quality images tailored to specific needs. With options for image dimensions, styles, and advanced features, developers can seamlessly integrate this functionality into their applications for enhanced user engagement.
Prerequisites
To begin using the Cognitive Actions, you'll need an API key for authentication. This key should be included in the headers of your requests to the Cognitive Actions endpoint. The typical structure involves passing the API key as a Bearer token to ensure secure access to the actions.
Cognitive Actions Overview
Generate Chibi Face Stickers
The Generate Chibi Face Stickers action allows you to transform an input image into a unique chibi-style sticker, using a variety of customizable parameters.
- Category: Image Generation
- Purpose: This action generates high-quality chibi face stickers by processing an input image with options for inpainting, customizable dimensions, and style adjustments.
Input Schema
The following fields are required and optional for the input schema:
- Required:
prompt: Descriptive text to guide the image generation.
- Optional:
mask: URI for an image mask (overrides dimensions if provided).seed: Random seed for reproducibility.image: URI for the input image (overrides dimensions if provided).width: Width of the generated image (256 to 1440 pixels).height: Height of the generated image (256 to 1440 pixels).goFast: Enable fast mode for quicker predictions.outputCount: Number of images to generate (1 to 4).guidanceScale: Guidance scale for the diffusion process (0 to 10).outputQuality: Output quality on a scale from 0 to 100.imageAspectRatio: Defines the aspect ratio for the generated image.imageOutputFormat: File format for output images (webp, jpg, png).- Additional parameters for advanced customization.
Here’s an example of the JSON payload required to call this action:
{
"prompt": "face sticker of KAWAIFACE in the style of chibi kawaii sticker of the face of obama president. Just give me the head and face, nothing else. In black and white, flat 2d cute. Chibi, minimal",
"loraScale": 1,
"outputCount": 2,
"guidanceScale": 3.5,
"outputQuality": 90,
"extraLoraScale": 0,
"inferenceModel": "dev",
"promptStrength": 0.8,
"imageAspectRatio": "1:1",
"imageOutputFormat": "webp",
"inferenceStepCount": 28
}
Output
Upon successful execution, the action returns an array of URLs pointing to the generated images. Here’s an example of the expected output:
[
"https://assets.cognitiveactions.com/invocations/b64c8918-3915-4e9c-ba7d-ef59804372b3/8fcb85bc-0413-4b93-ae4f-9a760b0e1812.webp",
"https://assets.cognitiveactions.com/invocations/b64c8918-3915-4e9c-ba7d-ef59804372b3/d140df74-49dd-4000-be01-8435ae92b62b.webp"
]
Conceptual Usage Example (Python)
Here’s how you might call the Generate Chibi Face Stickers 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 = "124dc972-47a1-4e82-bee5-2216c20129a2" # Action ID for Generate Chibi Face Stickers
# Construct the input payload based on the action's requirements
payload = {
"prompt": "face sticker of KAWAIFACE in the style of chibi kawaii sticker of the face of obama president. Just give me the head and face, nothing else. In black and white, flat 2d cute. Chibi, minimal",
"loraScale": 1,
"outputCount": 2,
"guidanceScale": 3.5,
"outputQuality": 90,
"extraLoraScale": 0,
"inferenceModel": "dev",
"promptStrength": 0.8,
"imageAspectRatio": "1:1",
"imageOutputFormat": "webp",
"inferenceStepCount": 28
}
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 the code snippet above, replace the placeholder for the API key and endpoint URL with your actual credentials. The action_id corresponds to the "Generate Chibi Face Stickers" action. The payload is structured to match the required input schema.
Conclusion
The Generate Chibi Face Stickers action is a powerful tool for developers looking to integrate creative image generation into their applications. With an array of customizable parameters, this action can produce unique and high-quality stickers that enhance user interaction. Explore these capabilities in your next project and unleash your creativity with Cognitive Actions!