Enhance Your Images with Shalommi's Advanced Prediction Actions

In the world of digital content creation, the quality of images can significantly influence user engagement and satisfaction. Shalommi offers a powerful set of Cognitive Actions designed to generate enhanced image predictions, allowing developers to create stunning visuals with ease. The ability to adjust various parameters such as image mask, dimensions, and quality means you have complete control over the output. With options for different inference models, you can choose the speed and quality that best fits your project needs.
Imagine the possibilities: whether you're building a social media application that requires eye-catching images, developing an e-commerce platform needing product photos, or creating content-rich blogs, Shalommi's image generation capabilities can streamline your workflow and enhance your visual content.
Prerequisites
To get started with Shalommi's Cognitive Actions, you'll need a valid API key and a basic understanding of making API calls. This will ensure you can seamlessly integrate the image generation capabilities into your applications.
Generate Enhanced Image Predictions
The "Generate Enhanced Image Predictions" action enables developers to create high-quality images based on textual prompts. This action is particularly valuable for tasks such as image inpainting, where you want to modify or enhance existing images while maintaining a cohesive look.
Purpose
This action allows you to generate images with adjustable parameters, including seed values for reproducibility, aspect ratios, and image quality settings. You can choose between two inference models (dev and schnell) to balance speed and quality according to your project needs.
Input Requirements
The input for this action requires a structured object, including:
- prompt: A text prompt that guides the image generation (e.g., "A man is looking to the camera").
- mask: Optional URI for an image mask used in image inpainting.
- seed: An integer to ensure reproducibility.
- width/height: Dimensions for custom aspect ratios.
- outputCount: Number of images to generate (1 to 4).
- Additional parameters like
loraScale,guidanceScale, andimageOutputFormatto further refine the output.
Expected Output
The output will be a URI link to the generated image, providing a direct way to access the newly created visual content.
Use Cases
- Social Media Content: Create unique images tailored to specific themes or campaigns, enhancing user engagement.
- E-commerce: Generate product images that stand out, helping to attract more customers.
- Creative Projects: Use the action in artistic applications where image manipulation and enhancement are required.
- Blogging: Automatically generate relevant images based on your written content, saving time and resources.
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 = "d2dc6e77-3dd8-4b8c-99cf-f79471b46105" # Action ID for: Generate Enhanced Image Predictions
# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
"prompt": "shalommi A a man is looking to the camera",
"loraScale": 1,
"outputCount": 1,
"guidanceScale": 3,
"enableFastMode": false,
"inferenceModel": "dev",
"promptStrength": 0.8,
"imageAspectRatio": "16:9",
"outputResolution": "1",
"imageOutputFormat": "jpg",
"imageOutputQuality": 80,
"additionalLoraScale": 1,
"inferenceStepsCount": 28
}
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
Shalommi's image generation capabilities empower developers to enhance their applications with high-quality visuals. By leveraging customizable parameters and model choices, you can create images that meet specific needs, improving the overall user experience. Whether for marketing, e-commerce, or creative endeavors, the possibilities are endless. Start integrating Shalommi today and unlock the potential of advanced image predictions in your projects!