Create Stunning Images with Yanisse's Inpainting Action

In the world of digital content creation, visual appeal is paramount. The Yanisse service offers powerful Cognitive Actions that enable developers to generate images using advanced inpainting techniques. This functionality not only enhances creativity but also streamlines the image generation process, allowing you to produce high-quality visuals quickly and efficiently. With the ability to customize your images through detailed prompts and parameters, Yanisse's inpainting action is an essential tool for developers looking to elevate their projects.
Imagine creating a serene landscape or a fantastical scene with just a few lines of description. Whether you are a game developer designing immersive environments, a marketing professional crafting compelling visuals for campaigns, or an artist exploring new creative avenues, the Yanisse inpainting action provides the flexibility and speed you need. This action supports deterministic image generation, allowing you to reproduce images consistently by leveraging seeds and model selection options.
Prerequisites
To get started with Yanisse's Cognitive Actions, you'll need an API key for the service and a basic understanding of how to make API calls.
Generate Image with Inpainting
The Generate Image with Inpainting action is designed to create images from textual prompts while offering advanced customization options. This action solves the problem of generating unique and compelling visuals that can be tailored to specific themes or concepts.
Input Requirements
The action requires a structured input that includes a prompt to guide the image generation. Other optional parameters include:
- mask: A URI for an image mask used in inpainting mode.
- seed: An integer seed for reproducibility.
- image: A URI of the input image for transformation.
- width and height: Dimensions for the generated image (if using custom aspect ratios).
- goFast: A boolean to enable faster predictions.
- modelType: Choice between 'dev' for detailed processing and 'schnell' for speed.
- Additional parameters such as guidanceScale, outputQuality, and numOutputs help refine the output.
Expected Output
The output is a generated image based on the input prompt, which can be returned in formats like webp, jpg, or png. For example, an output might resemble a beautifully crafted image of a serene stream flowing through a mystical forest.
Use Cases for this Specific Action
- Game Development: Create immersive environments with detailed landscapes based on user-defined narratives.
- Marketing: Generate eye-catching visuals for promotional materials that resonate with target audiences.
- Art and Design: Explore new creative directions by transforming textual ideas into visual representations.
- Content Creation: Produce unique images for blogs, websites, or social media that stand out and capture attention.
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 = "b5c31385-bc54-43cd-b121-d2c9836bcd37" # Action ID for: Generate Image with Inpainting
# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
"prompt": "A serene stream flowing through a mystical forest, delicate female faces emerging from the water, including Yanisse face subtly reflected in the stream's surface, the ambiance serene and mysterious, captured in a realistic photograph with soft natural light, focusing on the ethereal beauty of the naiads",
"loraScale": 1,
"modelType": "dev",
"numOutputs": 1,
"guidanceScale": 5.07,
"outputQuality": 100,
"extraLoraScale": 0.8,
"imageAspectRatio": "16:9",
"imageOutputFormat": "png",
"numInferenceSteps": 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
The Yanisse inpainting action empowers developers to create stunning images tailored to their specific needs, enhancing creativity while saving time. With its robust set of features, you can easily generate high-quality visuals that align with your project requirements. As you explore the capabilities of Yanisse, consider how you can integrate this powerful tool into your applications to elevate your visual content creation. Embrace the future of image generation with Yanisse and unlock new possibilities for your projects.