Enhance Your Images with jbilcke/flux-satellite Cognitive Actions

The jbilcke/flux-satellite spec provides powerful Cognitive Actions for image generation, particularly through enhanced image inpainting techniques. With customizable settings such as masks, prompts, and aspect ratios, developers can create high-quality augmented images tailored to their specific needs. These pre-built actions streamline the process of enhancing images, allowing for improved speed and quality with advanced models.
Prerequisites
Before you can leverage the Cognitive Actions in this spec, you will need an API key for the Cognitive Actions platform. This key should be included in the request headers for authentication when invoking the actions. Ensure that you have access to the appropriate environment where you can make HTTP requests.
Cognitive Actions Overview
Generate Augmented Image
The Generate Augmented Image action allows developers to create enhanced images using customizable prompts and settings. This action is particularly beneficial for applications needing to generate realistic or stylistically unique images based on existing visuals.
Input
The input schema for this action requires the prompt field, while other fields are optional but provide additional customization. Here's a breakdown of the input schema:
- prompt (required): A string that describes the desired image. For example,
"satellite view of a small city, american suburb, in the style of TOK". - mask (optional): URI for the image mask in image inpainting mode.
- seed (optional): An integer for ensuring consistent results.
- image (optional): URI of the input image.
- width (optional): Desired pixel width (256-1440).
- height (optional): Desired pixel height (256-1440).
- goFast (optional): Boolean to optimize for speed.
- aspectRatio (optional): Sets the output image's aspect ratio (default is
1:1). - numOutputs (optional): Number of images to generate (1-4).
- outputFormat (optional): Format of the generated images (
webp,jpg, orpng). - guidanceScale (optional): Scale for the diffusion process (0-10).
- outputQuality (optional): Quality level when saving images (0-100).
- inferenceModel (optional): Selects the model for inference, either
devorschnell.
Example Input
{
"goFast": false,
"prompt": "satellite view of a small city, american suburb, in the style of TOK",
"loraScale": 1,
"numOutputs": 1,
"aspectRatio": "1:1",
"outputFormat": "webp",
"guidanceScale": 3,
"outputQuality": 90,
"extraLoraScale": 1,
"inferenceModel": "dev",
"promptStrength": 0.8,
"imageMegapixels": "1",
"numInferenceSteps": 50
}
Output
The action typically returns a URI pointing to the generated image. Here’s an example of the output you might receive:
[
"https://assets.cognitiveactions.com/invocations/64cbb9d4-4d62-4e50-bfde-a130810177be/5d757626-29a1-41af-865d-940ec57e3d20.webp"
]
Conceptual Usage Example (Python)
Here’s a conceptual Python snippet demonstrating how a developer might invoke the Generate Augmented Image 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 = "b0e012df-02d2-4b58-9a89-908efee893b2" # Action ID for Generate Augmented Image
# Construct the input payload based on the action's requirements
payload = {
"goFast": False,
"prompt": "satellite view of a small city, american suburb, in the style of TOK",
"loraScale": 1,
"numOutputs": 1,
"aspectRatio": "1:1",
"outputFormat": "webp",
"guidanceScale": 3,
"outputQuality": 90,
"extraLoraScale": 1,
"inferenceModel": "dev",
"promptStrength": 0.8,
"imageMegapixels": "1",
"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}")
In this snippet, you replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The payload is structured to meet the action's input requirements, and the endpoint URL is a hypothetical example.
Conclusion
The jbilcke/flux-satellite Cognitive Actions, particularly the Generate Augmented Image action, empower developers to create customized and high-quality images efficiently. With a variety of settings available, you can tailor the image generation process to suit your application's unique requirements. Start integrating these actions today to enhance your visual content!