Generate Stunning Images with the Leopard Boots Cognitive Actions

In the ever-evolving landscape of digital creativity, generating high-quality images has become a top priority for developers and creators alike. The Leopard Boots Cognitive Actions provide a powerful API for generating images using advanced inpainting techniques, allowing for customization of various image properties. Whether you're creating unique visuals for your application or enhancing existing images, these pre-built actions offer a seamless integration experience.
Prerequisites
Before diving into the integration of the Leopard Boots Cognitive Actions, ensure you have the following:
- An API key to access the Cognitive Actions platform.
- A basic understanding of JSON structure for crafting input payloads.
- Familiarity with making HTTP requests in your programming language of choice.
Authentication typically involves including your API key in the headers of your HTTP requests.
Cognitive Actions Overview
Generate Image with Inpainting and LoRA
This action allows developers to generate high-quality images using advanced inpainting techniques, optionally enhanced with LoRA weights. It supports various customization options like aspect ratio, resolution, and quality settings.
Input
The input schema for this action requires the following fields:
- prompt (required): A text prompt for generating an image. (e.g., "A pair of LPRDBTS boots, in a shop window display")
- model (optional): Choose "dev" for detailed output or "schnell" for rapid results.
- goFast (optional): Enable for faster predictions.
- denoisingSteps (optional): Total steps for generating detailed images (default is 28).
- imageAspectRatio (optional): Aspect ratio for the generated image (default is "1:1").
- imageOutputFormat (optional): Format for saving the output images (default is "webp").
- imageOutputQuality (optional): Quality setting for saving images (default is 80).
- numberOfOutputs (optional): Number of image outputs to generate (default is 1).
Here’s an example of a JSON payload for this action:
{
"model": "dev",
"goFast": false,
"prompt": "A pair of LPRDBTS boots, in a shop window display",
"denoisingSteps": 28,
"imageAspectRatio": "1:1",
"imageOutputFormat": "webp",
"imageOutputQuality": 80,
"numberOfOutputs": 1
}
Output
The action typically returns a URL pointing to the generated image. For example:
[
"https://assets.cognitiveactions.com/invocations/489e7e57-9a14-4755-a9a0-f33059098a8d/8ff7a0b6-55fa-4e40-8f88-151f2d292759.webp"
]
Conceptual Usage Example (Python)
Here's a conceptual Python code snippet demonstrating how to call this 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 = "70c080de-d838-45ad-9bf2-72f523c1365a" # Action ID for Generate Image with Inpainting and LoRA
# Construct the input payload based on the action's requirements
payload = {
"model": "dev",
"goFast": False,
"prompt": "A pair of LPRDBTS boots, in a shop window display",
"denoisingSteps": 28,
"imageAspectRatio": "1:1",
"imageOutputFormat": "webp",
"imageOutputQuality": 80,
"numberOfOutputs": 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 snippet, replace the placeholder for COGNITIVE_ACTIONS_API_KEY with your actual API key. The action ID and the input payload demonstrate how to structure your request, and the endpoint URL is illustrative.
Conclusion
The Leopard Boots Cognitive Actions offer a robust way to generate stunning images tailored to your application's needs. With customizable options for output quality, aspect ratio, and generation speed, you can create unique visuals that stand out. Next steps could involve exploring more advanced features like LoRA weights or integrating these actions into broader workflows for automated image generation. Happy coding!