Enhance Your Applications with Image Generation Using SkyTells Research Focus Actions

In the evolving landscape of application development, integrating advanced image generation capabilities can significantly enhance user experience. The SkyTells Research Focus API offers a powerful Cognitive Action called Generate Enhanced Images. This action allows developers to create and refine images based on detailed parameters, providing a range of options for customization. By utilizing these pre-built actions, developers can save time and resources while delivering engaging and tailored content to their users.
Prerequisites
Before diving into the integration of the Cognitive Actions, ensure you have an API key for the Cognitive Actions platform. This key is essential for authenticating your requests. Conceptually, you will be passing this API key in the headers of your API requests to access the image generation capabilities.
Cognitive Actions Overview
Generate Enhanced Images
The Generate Enhanced Images action is designed to create and enhance images using a variety of advanced parameters. This includes options for inpainting, sharpness adjustments, and more, allowing for highly tailored image generation.
Input
The input for this action is structured as a JSON object that includes both required and optional fields. Below is a detailed schema followed by an example input.
Schema:
{
"prompt": "string",
"imageSeed": "integer",
"sharpness": "number",
"imageNumber": "integer",
"guidanceScale": "number",
"refinerSwitch": "number",
"negativePrompt": "string",
"controlNetStop1": "number",
"controlNetStop2": "number",
"controlNetStop3": "number",
"controlNetStop4": "number",
"controlNetType1": "string",
"controlNetType2": "string",
"controlNetType3": "string",
"controlNetType4": "string",
"inpaintStrength": "number",
"lorasCustomUrls": "string",
"performanceMode": "string",
"styleSelections": "string",
"useDefaultLoras": "boolean",
"controlNetImage1": "string",
"controlNetImage2": "string",
"controlNetImage3": "string",
"controlNetImage4": "string",
"inpaintInputMask": "string",
"controlNetWeight1": "number",
"controlNetWeight2": "number",
"controlNetWeight3": "number",
"controlNetWeight4": "number",
"inpaintInputImage": "string",
"outpaintSelections": "string",
"outpaintDistanceTop": "integer",
"upscaleOrVaryMethod": "string",
"aspectRatioSelection": "string",
"outpaintDistanceLeft": "integer",
"outpaintDistanceRight": "integer",
"outpaintDistanceBottom": "integer",
"inpaintAdditionalPrompt": "string",
"upscaleOrVaryInputImage": "string",
"upscaleOrVaryUpscaleValue": "number"
}
Example Input:
{
"prompt": "A photo of a girl sitting in a private jet",
"imageSeed": -1,
"sharpness": 3,
"imageNumber": 1,
"guidanceScale": 7,
"refinerSwitch": 0.5,
"negativePrompt": "",
"controlNetType1": "ImagePrompt",
"controlNetType2": "ImagePrompt",
"controlNetType3": "ImagePrompt",
"controlNetType4": "ImagePrompt",
"inpaintStrength": 0.5,
"lorasCustomUrls": "",
"performanceMode": "Quality",
"styleSelections": "Fooocus V2,Fooocus Enhance,Fooocus Sharp",
"useDefaultLoras": true,
"outpaintSelections": "",
"outpaintDistanceTop": 0,
"upscaleOrVaryMethod": "Upscale (2x)",
"aspectRatioSelection": "1152*896",
"outpaintDistanceLeft": 0,
"outpaintDistanceRight": 0,
"outpaintDistanceBottom": 0,
"inpaintAdditionalPrompt": "",
"upscaleOrVaryUpscaleValue": 0
}
Output
The output of the Generate Enhanced Images action typically includes a list of image paths and generated seed values.
Example Output:
{
"paths": [
"https://assets.cognitiveactions.com/invocations/c09ac1e2-7f6b-4df9-9e47-24da8f5b9c7b/040320a8-4659-4a49-9af5-7fad23075040.png"
],
"seeds": [
892760357835221000
]
}
Conceptual Usage Example (Python)
Here’s a conceptual example of how you can call the Generate Enhanced Images 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 = "1762d877-805d-4f6f-9f03-d99420ab53ca" # Action ID for Generate Enhanced Images
# Construct the input payload based on the action's requirements
payload = {
"prompt": "A photo of a girl sitting in a private jet",
"imageSeed": -1,
"sharpness": 3,
"imageNumber": 1,
"guidanceScale": 7,
"refinerSwitch": 0.5,
"negativePrompt": "",
"controlNetType1": "ImagePrompt",
"controlNetType2": "ImagePrompt",
"controlNetType3": "ImagePrompt",
"controlNetType4": "ImagePrompt",
"inpaintStrength": 0.5,
"lorasCustomUrls": "",
"performanceMode": "Quality",
"styleSelections": "Fooocus V2,Fooocus Enhance,Fooocus Sharp",
"useDefaultLoras": True,
"outpaintSelections": "",
"outpaintDistanceTop": 0,
"upscaleOrVaryMethod": "Upscale (2x)",
"aspectRatioSelection": "1152*896",
"outpaintDistanceLeft": 0,
"outpaintDistanceRight": 0,
"outpaintDistanceBottom": 0,
"inpaintAdditionalPrompt": "",
"upscaleOrVaryUpscaleValue": 0
}
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 Python code snippet, developers can see how to structure the input JSON payload correctly for the Generate Enhanced Images action. The action ID and input payload are clearly indicated, and the endpoint URL is illustrative, highlighting where developers should make their requests.
Conclusion
By leveraging the Generate Enhanced Images action from the SkyTells Research Focus API, developers can integrate advanced image generation capabilities into their applications with ease. Whether you’re looking to create stunning visuals or refine existing images, this action offers a robust set of features to enhance user engagement. Explore the possibilities, experiment with parameters, and elevate your application’s visual content today!