Create Stunning Images with Ai Luke's Custom Generation Action

In today’s digital landscape, the demand for unique and high-quality images continues to grow. With Ai Luke, developers can leverage powerful Cognitive Actions to generate stunning images tailored to specific needs. The "Generate Image with Custom Parameters" action allows for extensive customization, enabling users to create images that align perfectly with their vision. This action not only streamlines the image creation process but also enhances creativity by allowing developers to specify various parameters such as prompts, aspect ratios, and more.
Whether you are building a content creation platform, designing an art generation tool, or enhancing a game with unique visuals, this action provides the flexibility and speed you need. With optimized models for rapid image generation, Ai Luke simplifies the process of creating visually appealing content without requiring extensive graphical design skills.
Prerequisites
To get started with Ai Luke's Cognitive Actions, you’ll need your API key for accessing the service and a basic understanding of making API calls.
Generate Image with Custom Parameters
The "Generate Image with Custom Parameters" action is designed to create high-quality images based on customizable inputs. It addresses the need for unique visuals tailored to specific prompts and styles, making it an invaluable tool for developers and content creators.
Input Requirements
The input schema for this action requires a prompt and can include several optional parameters such as:
- Prompt: The text description of the image to be generated (e.g., "a photo ok Luke, a man standing at malaga beach street, at sunset").
- Model Type: Choose between 'dev' for detailed generation or 'schnell' for faster results.
- Aspect Ratio: Define the image's aspect ratio, with options for custom dimensions.
- Additional parameters: Such as image masks, seed values for reproducibility, and various intensity settings for prompts and LoRA weights.
Expected Output
The expected output is a URL link to the generated image in the specified format (e.g., .webp, .jpg, .png). For example, a successful output may look like:
https://assets.cognitiveactions.com/invocations/3e762807-eefa-4576-8147-3082d8f7f6d3/679d413d-d581-4df8-a5f4-82b3d225d937.webp
Use Cases for this Specific Action
- Content Creation: Ideal for bloggers and marketers who need unique images tailored to their articles or campaigns without relying on stock images.
- Game Development: Game developers can use this action to generate character designs or backgrounds that fit their game’s narrative and style.
- Art and Design: Artists can experiment with different prompts and parameters to create original artwork, pushing the boundaries of their creativity.
- Social Media: Create eye-catching visuals for posts, ads, and stories that stand out in users' feeds.
import requests
import json
# Replace with your actual Cognitive Actions API key and endpoint
# Ensure your environment securely handles the API key
COGNITIVE_ACTIONS_API_KEY = "YOUR_COGNITIVE_ACTIONS_API_KEY"
# This endpoint URL is hypothetical and should be documented for users
COGNITIVE_ACTIONS_EXECUTE_URL = "https://api.cognitiveactions.com/actions/execute"
action_id = "5d2287b2-1342-4f2a-beee-1bdb13bac085" # Action ID for: Generate Image with Custom Parameters
# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
"prompt": "a photo ok Luke, a man standing at malaga beach street, at sunset",
"modelType": "dev",
"megapixels": "1",
"loraIntensity": 1,
"enableFastMode": false,
"inferenceSteps": 28,
"numberOfOutputs": 1,
"promptIntensity": 0.8,
"imageAspectRatio": "1:1",
"guidanceIntensity": 3,
"imageOutputFormat": "webp",
"imageOutputQuality": 80,
"additionalLoraIntensity": 1
}
headers = {
"Authorization": f"Bearer {COGNITIVE_ACTIONS_API_KEY}",
"Content-Type": "application/json",
# Add any other required headers for the Cognitive Actions API
}
# Prepare the request body for the hypothetical execution endpoint
request_body = {
"action_id": action_id,
"inputs": payload
}
print(f"--- Calling Cognitive Action: {action.name or action_id} ---")
print(f"Endpoint: {COGNITIVE_ACTIONS_EXECUTE_URL}")
print(f"Action ID: {action_id}")
print("Payload being sent:")
print(json.dumps(request_body, indent=2))
print("------------------------------------------------")
try:
response = requests.post(
COGNITIVE_ACTIONS_EXECUTE_URL,
headers=headers,
json=request_body
)
response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx)
result = response.json()
print("Action executed successfully. Result:")
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 (non-JSON): {e.response.text}")
print("------------------------------------------------")
Conclusion
The "Generate Image with Custom Parameters" action from Ai Luke empowers developers to create visually stunning images tailored to their exact specifications. Its extensive customization options and fast generation capabilities make it an essential tool for anyone looking to enhance their content with unique visuals. Whether your goal is to improve user engagement, create compelling narratives, or simply explore your creativity, Ai Luke's Cognitive Actions provide the flexibility and power needed to bring your ideas to life.
To get started, sign up for your API key, and dive into the world of image generation with Ai Luke!