Create Stunning Images with Oxana's Inpainting Capabilities

Oxana offers a powerful suite of Cognitive Actions designed to generate high-quality images tailored to your specific needs. With its advanced inpainting capabilities, developers can easily craft images by customizing various parameters such as mask inpainting, prompt strength, and LoRA weights. This flexibility not only enhances the creative process but also accelerates image generation, allowing for rapid iterations and refinements.
Whether you're working on digital art, product design, or content creation, Oxana's image generation features can streamline your workflow. Imagine being able to generate unique visuals in mere minutes, adjusting the characteristics of each image to fit your vision. This opens up a world of possibilities for artists, marketers, and developers alike, making it easier than ever to produce stunning visuals that captivate your audience.
Prerequisites
To get started with Oxana, you will need a Cognitive Actions API key and a basic understanding of making API calls.
Generate Image with Inpainting and LoRA
The Generate Image with Inpainting and LoRA action allows you to create images with a variety of customizable aspects. This action is particularly beneficial for developers looking to produce high-quality images while maintaining control over the generated content. By leveraging different models optimized for speed and detail, you can adjust settings such as aspect ratio, megapixels, and guidance scale to achieve the desired output.
Input Requirements
To use this action, you will need to provide the following input parameters:
- prompt (required): A detailed text prompt that describes the image you want to generate.
- mask (optional): A URI of the image mask for inpainting.
- image (optional): A URI of an input image for transformations.
- goFast (optional): A boolean to toggle speed-optimized generation.
- width and height (optional): Dimensions for custom aspect ratios.
- modelType: Choose between 'dev' for detail or 'schnell' for speed.
- numOutputs: Specify the number of images to generate (1 to 4).
- guidanceScale: Adjust the guidance for the diffusion process.
- outputQuality: Set the quality of the output image.
- additional parameters: Such as LoRA weights, prompt strength, and image aspect ratio.
Expected Output
The action will return an array of generated image URLs based on the input parameters you provided. For example:
- Output:
https://assets.cognitiveactions.com/invocations/1b9c8c2f-2b77-4c62-bf1f-548ca5bed7dc/679e9984-5c35-47b9-bccb-6b313dc92cb9.jpghttps://assets.cognitiveactions.com/invocations/1b9c8c2f-2b77-4c62-bf1f-548ca5bed7dc/8cd66e04-6a33-462b-b923-86b8734c6c4c.jpg- And more...
Use Cases for this Action
- Digital Art Creation: Artists can use this action to generate unique artworks based on detailed prompts, allowing for rapid experimentation with different styles and themes.
- Product Visualization: Marketers can create product images tailored to specific campaigns, adjusting elements to resonate with target audiences.
- Content Generation: Writers and content creators can generate illustrative images that complement their narratives, enhancing the overall engagement of their projects.
```python
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 = "304a1fa5-55ae-46e4-aaf8-cf4870858ca6" # Action ID for: Generate Image with Inpainting and LoRA
# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
"goFast": false,
"prompt": "Oxana in a sleek black-on-black outfit: tailored blazer over a mesh top, slicked-back bun, bold eyeliner and matte nude lips. She’s in a dark podcast room with textured acoustic panels and a glowing ring light reflecting in her eyes. The photo captures her adjusting her headphones, intense gaze toward the mic. Behind her, warm tungsten lights create bokeh and atmosphere. The look is high-fashion, powerful, moody.",
"loraScale": 1,
"modelType": "dev",
"numOutputs": 4,
"guidanceScale": 3,
"outputQuality": 100,
"extraLoraScale": 1,
"promptStrength": 0.8,
"imageAspectRatio": "9:16",
"imageOutputFormat": "jpg",
"numInferenceSteps": 45,
"approximateMegapixels": "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
Oxana's image generation capabilities using inpainting and LoRA weights provide a versatile toolset for developers aiming to create high-quality, customized images quickly. With a focus on flexibility and speed, these actions can significantly enhance creative workflows across various industries.
As you explore these features, consider how they can be integrated into your projects to elevate your visual content. The next step is to obtain your API key and start experimenting with the diverse parameters available to unleash your creativity!