Create Stunning Custom Images with Uildsonaraujo's Inpainting Action

In the world of digital content creation, the ability to generate unique and visually striking images can set your projects apart. Uildsonaraujo offers a powerful Cognitive Action that enables developers to create customized images using advanced inpainting techniques. This action allows you to input image URLs and guiding prompts, giving you the flexibility to select from different models optimized for speed or quality. Whether you need images for marketing materials, social media, or artistic projects, Uildsonaraujo's inpainting capabilities can streamline your workflow and enhance your creative output.
Prerequisites
To get started with Uildsonaraujo's Cognitive Actions, you will need an API key. Familiarity with making API calls will also be essential as you integrate these features into your applications.
Generate Custom Image with Inpainting
The Generate Custom Image with Inpainting action is designed to create tailored images by utilizing inpainting techniques. This action addresses the need for unique and high-quality visuals by allowing you to specify detailed prompts and customize various parameters, such as aspect ratios and output formats.
Input Requirements: You will need to provide the following inputs:
- Prompt: A detailed description of the image you want to create.
- Image: An optional input image for inpainting.
- Mask: An optional mask image for more precise edits.
- Aspect Ratio, Width, Height: Customizable dimensions if you select a 'custom' aspect ratio.
- Model Weights, Guidance Scale, Output Quality: Additional parameters to control the output quality and characteristics.
For example, a sample input could look like this:
{
"image": "https://example.com/sample.jpg",
"prompt": "A futuristic city skyline at sunset, with flying cars and neon lights.",
"aspectRatio": "16:9",
"outputFormat": "png",
"numOutputs": 3
}
Expected Output: The output will be a set of generated images based on your specifications. Each output will be a link to the image, allowing you to easily integrate it into your projects.
A typical output could look like:
[
"https://assets.cognitiveactions.com/image1.png",
"https://assets.cognitiveactions.com/image2.png",
"https://assets.cognitiveactions.com/image3.png"
]
Use Cases for this Specific Action:
- Marketing Campaigns: Create eye-catching visuals to promote products or services.
- Social Media Content: Generate unique images that stand out in feeds.
- Art and Design Projects: Use inpainting to refine concepts or create entirely new artwork based on existing images.
- Content Personalization: Tailor images for specific audiences or themes by adjusting prompts and parameters.
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 = "80556055-d459-4902-bd88-6fc6ee5e38e7" # Action ID for: Generate Custom 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 = {
"image": "https://replicate.delivery/pbxt/Mfex2sQ4OyKxABbwejPQUdyRIYLdGqi36xOsf1TUbOOjkFNc/ai-generated-8721441_1280.jpg",
"goFast": false,
"prompt": "wennylife A tall, slim man with a strong male build, standing in a photo studio with a gritty urban vibe. He strikes a confident rapper pose, showing hand signs and wearing streetwear: oversized hoodie, chains, rings, and dark sunglasses. The background has professional studio lighting with smoke effects, creating a dramatic and edgy mood. The man exudes a gangster rapper attitude, serious expression, arms crossed or throwing gang signs, surrounded by luxury props like a mic, speakers, and maybe dollar bills in the air. Shot with a Sony camera, preserving natural skin tones and facial features. No blue eyes, no hair description.",
"loraScale": 1,
"numOutputs": 4,
"aspectRatio": "1:1",
"outputFormat": "png",
"guidanceScale": 3,
"outputQuality": 100,
"extraLoraScale": 1.21,
"inferenceModel": "dev",
"promptStrength": 0.8,
"imageResolution": "1",
"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
Uildsonaraujo's Generate Custom Image with Inpainting action offers developers a robust tool for creating customized images tailored to their specific needs. With its flexible parameters and advanced inpainting capabilities, this action can significantly enhance your content creation process. Whether you're looking to produce marketing materials, social media content, or artistic projects, the possibilities are endless. Start exploring this powerful feature today and elevate your visual storytelling!