Create Stunning New Balance 992 Shoe Images with Cognitive Actions

Integrating advanced image generation capabilities into your applications can significantly enhance user experiences, especially in industries like e-commerce and digital marketing. The iamsml/new-balance-sdxl specification provides a powerful Cognitive Action that allows developers to generate images of the New Balance 992 running shoe model. This action leverages a trained model to produce high-quality images with customizable parameters, making it a versatile tool for various creative applications.
Prerequisites
Before diving into the integration, you will need:
- An API key for the Cognitive Actions platform to authenticate your requests.
- Basic familiarity with JSON payloads and making HTTP requests.
For authentication, you will typically include the API key in the headers of your requests, formatted as follows:
Authorization: Bearer YOUR_COGNITIVE_ACTIONS_API_KEY
Cognitive Actions Overview
Generate New Balance 992 Shoe Images
Description: This action generates images of the New Balance 992 running shoe model using a trained model. It supports both img2img and inpainting modes, allowing for a range of creative possibilities, from generating entirely new images to refining existing ones.
Category: image-generation
Input
The input schema for this action consists of several fields, each with specific roles:
- prompt (string): A textual description guiding the image generation process. (e.g., "photo of @992 running shoe, on a table in the forest")
- width (integer): The width of the output image in pixels. (default: 1024)
- height (integer): The height of the output image in pixels. (default: 1024)
- numOutputs (integer): The number of images to generate. (default: 1, max: 4)
- guidanceScale (number): Determines adherence to the prompt. (default: 7.5, range: 1 to 50)
- applyWatermark (boolean): Toggles watermark application on generated images. (default: true)
- Additional optional fields include loraScale, refineStyle, negativePrompt, numInferenceSteps, and more.
Example Input:
{
"width": 512,
"height": 512,
"prompt": "photo of @992 running shoe, on a table in the forrest",
"loraScale": 0.7,
"numOutputs": 3,
"refineStyle": "expert_ensemble_refiner",
"guidanceScale": 7.5,
"applyWatermark": true,
"negativePrompt": "lowres, error, cropped, worst quality, low quality...",
"promptStrength": 0.8,
"highNoiseFraction": 0.8,
"numInferenceSteps": 50
}
Output
The action will typically return an array of URLs pointing to the generated images. Each image URL can be used directly in your application.
Example Output:
[
"https://assets.cognitiveactions.com/invocations/1f830615-4cb0-4f10-b680-30bb32aaa08b/c5f4c92e-f8f6-446a-b744-3631c716dacd.png",
"https://assets.cognitiveactions.com/invocations/1f830615-4cb0-4f10-b680-30bb32aaa08b/7ec42e6b-4c46-43f5-8a8e-7323b1c33fc2.png",
"https://assets.cognitiveactions.com/invocations/1f830615-4cb0-4f10-b680-30bb32aaa08b/d81c6ad4-0e05-4499-a46f-8dd1bace4fb4.png"
]
Conceptual Usage Example (Python)
Here's a conceptual Python code snippet demonstrating how to call the Generate New Balance 992 Shoe Images 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 = "27468c6b-3e54-4fb2-b156-0d1cb6b66241" # Action ID for Generate New Balance 992 Shoe Images
# Construct the input payload based on the action's requirements
payload = {
"width": 512,
"height": 512,
"prompt": "photo of @992 running shoe, on a table in the forrest",
"loraScale": 0.7,
"numOutputs": 3,
"refineStyle": "expert_ensemble_refiner",
"guidanceScale": 7.5,
"applyWatermark": True,
"negativePrompt": "lowres, error, cropped, worst quality, low quality...",
"promptStrength": 0.8,
"highNoiseFraction": 0.8,
"numInferenceSteps": 50
}
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}")
This code snippet highlights where the action ID and input payload are incorporated. Note that the endpoint URL and request structure are illustrative and subject to your specific implementation details.
Conclusion
The Generate New Balance 992 Shoe Images action offers developers a robust solution for creating high-quality images tailored to their needs. By integrating this Cognitive Action into your applications, you can enhance visual content creation, streamline design workflows, and provide engaging user experiences. Consider experimenting with different prompts and settings to fully leverage the capabilities of this powerful tool!