Create Stunning Sketchy Bear Images with maczzzzzzz/sketchy Cognitive Actions

In the world of digital creativity, generating unique images can be a game-changer for developers looking to enhance their applications. The maczzzzzzz/sketchy API provides an exciting Cognitive Action that allows you to create detailed images in a sketchy style. With the ability to customize various aspects such as image dimensions, quality, and generation speed, integrating this feature into your application can elevate the user experience significantly.
Prerequisites
Before diving into using the Cognitive Actions, ensure you have the following:
- An API key for the Cognitive Actions platform, which will allow you to authenticate your requests.
- A basic understanding of how to make HTTP requests and handle JSON data.
For authentication, you will typically pass your API key in the headers of your requests.
Cognitive Actions Overview
Generate Sketchy Bear Images
Description: This action creates detailed images in a sketchy style using the Sketchy Bear model. You can customize aspects like image dimensions, quality, intensity, and fast generation mode to achieve your desired results.
Category: Image Generation
Input
The input schema requires the following fields:
- prompt (required): A text prompt for generating the image. Example: "in sketchy style, bear in a wheelchair going down a set of stairs".
- model (optional): Choose between
"dev"(28 steps) or"schnell"(4 steps) for inference. - guidanceScale (optional): Adjusts the guidance in the diffusion process, with recommended values around 2 to 3.5.
- numberOfOutputs (optional): Number of images to generate (default is 1, max is 4).
- imageOutputFormat (optional): Format of the output image (default is "webp").
- outputAspectRatio (optional): Aspect ratio for the generated image (default is "1:1").
- imageOutputQuality (optional): Quality level for the output image ranging from 0 to 100 (default is 80).
- additionalLoraScale (optional): Strength of additional LoRA application (default is 1).
- imagePromptStrength (optional): Strength of the prompt when using img2img (default is 0.8).
- loraApplicationScale (optional): Strength of the main LoRA application (default is 1).
- numberOfInferenceSteps (optional): Number of denoising steps for image generation (default is 28).
Here's an example of a valid JSON input payload for this action:
{
"model": "dev",
"prompt": "in sketchy style, bear in a wheelchair going down a set of stairs",
"guidanceScale": 3.5,
"numberOfOutputs": 1,
"imageOutputFormat": "webp",
"outputAspectRatio": "1:1",
"imageOutputQuality": 90,
"additionalLoraScale": 1,
"imagePromptStrength": 0.8,
"loraApplicationScale": 1,
"numberOfInferenceSteps": 28
}
Output
The action typically returns a list of URLs pointing to the generated images. Here’s an example of the expected output:
[
"https://assets.cognitiveactions.com/invocations/93f1b787-92f3-45da-a8f0-9787c3073fdc/7a685bd5-1fd5-433e-9256-3dbdb6533ab0.webp"
]
Conceptual Usage Example (Python)
Here’s a conceptual Python code snippet demonstrating how to call the Cognitive Actions execution endpoint for generating sketchy bear 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 = "9e6a0198-4286-4e79-9c16-7fadbea32552" # Action ID for Generate Sketchy Bear Images
# Construct the input payload based on the action's requirements
payload = {
"model": "dev",
"prompt": "in sketchy style, bear in a wheelchair going down a set of stairs",
"guidanceScale": 3.5,
"numberOfOutputs": 1,
"imageOutputFormat": "webp",
"outputAspectRatio": "1:1",
"imageOutputQuality": 90,
"additionalLoraScale": 1,
"imagePromptStrength": 0.8,
"loraApplicationScale": 1,
"numberOfInferenceSteps": 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 this snippet, you replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action ID and input payload are constructed according to the specifications provided.
Conclusion
The Generate Sketchy Bear Images action from the maczzzzzzz/sketchy API opens up exciting opportunities for developers to create custom images that can enhance their applications. By utilizing various customization options, you can generate unique visuals that engage users and enrich their experience. Explore this action further to see how your creativity can transform into stunning digital art!