Unlock Creative Potential with Novascope's Image Generation Cognitive Actions

In the realm of AI-driven creativity, the sundai-club/novascope API offers a powerful toolset for developers looking to harness image generation capabilities. The Cognitive Actions associated with Novascope allow for the creation of personalized images based on user-defined prompts and specific settings. These pre-built actions can streamline the process of generating high-quality visuals for various applications, from marketing materials to artistic projects.
Prerequisites
Before diving into the integration of Novascope's Cognitive Actions, ensure you have the following:
- An API key for the Cognitive Actions platform, which is essential for authentication when making requests.
- Familiarity with JSON, as the input and output structures are based on this format.
Authentication generally involves including your API key in the headers of your requests to access the desired functionality.
Cognitive Actions Overview
Generate Customized Image Using Novascope
This action utilizes a finely-tuned FLUX.1 model to generate personalized images based on user-defined prompts and settings. It supports various features, including image inpainting, aspect ratio adjustments, and quality settings, enabling developers to create tailored visual outputs effectively.
Input
The input for this action is structured as follows:
- Required Fields:
prompt: A string that describes what the generated image should depict (e.g., "delts playing soccer with cristiano ronaldo").
- Optional Fields:
mask: URI of an image mask (used in inpainting mode).seed: Integer for random number generation.image: URI of an input image for conversion.model: Select the model for inference (options: "dev", "schnell").width: Width of the generated image (if aspect ratio is set to custom).height: Height of the generated image (if aspect ratio is set to custom).goFast: Boolean to enable faster predictions.aspectRatio: Set the aspect ratio of the generated image (default: "1:1").guidanceScale: Number indicating the guidance scale for the diffusion process.numberOfOutputs: Integer for the number of images to generate (default: 1).imageOutputFormat: Format of the output images (default: "webp").imageOutputQuality: Quality of the output images (0 to 100).disableSafetyChecker: Option to bypass safety checks.numberOfInferenceSteps: Number of denoising steps (default: 28).
Here’s an example of a JSON payload that can be used to invoke this action:
{
"model": "dev",
"goFast": false,
"prompt": "delts playing soccer with cristiano ronaldo",
"aspectRatio": "1:1",
"guidanceScale": 3,
"mainLoraScale": 1,
"extraLoraScale": 1,
"promptStrength": 0.8,
"numberOfOutputs": 1,
"imageOutputFormat": "webp",
"imageOutputQuality": 80,
"approximateMegapixels": "1",
"numberOfInferenceSteps": 28
}
Output
Upon successful execution, this action returns a list of URLs pointing to the generated images. For example:
[
"https://assets.cognitiveactions.com/invocations/eb9196c8-5916-46fe-b3ae-5938364db97f/205bd1be-f7eb-4d4f-8b7e-31302b700887.webp"
]
Conceptual Usage Example (Python)
Here’s how you might call the Generate Customized Image Using Novascope 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 = "a7553200-554e-4079-87d6-31216511b494" # Action ID for Generate Customized Image Using Novascope
# Construct the input payload based on the action's requirements
payload = {
"model": "dev",
"goFast": False,
"prompt": "delts playing soccer with cristiano ronaldo",
"aspectRatio": "1:1",
"guidanceScale": 3,
"mainLoraScale": 1,
"extraLoraScale": 1,
"promptStrength": 0.8,
"numberOfOutputs": 1,
"imageOutputFormat": "webp",
"imageOutputQuality": 80,
"approximateMegapixels": "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 example, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action ID is specified as action_id, and the input payload is structured according to the requirements of the action.
Conclusion
The sundai-club/novascope Cognitive Actions provide a robust framework for image generation, enabling developers to create visually appealing and customized outputs effortlessly. By integrating these actions, you can explore a myriad of creative possibilities, whether for art, marketing, or other applications. Dive into the capabilities of Novascope and start enriching your applications today!