Create Stunning Custom Images with Xiaomicar

In today's fast-paced digital landscape, the ability to generate high-quality images quickly and efficiently is invaluable for developers across various industries. Enter Xiaomicar, a powerful service that enables you to create hyper-realistic images tailored to your specific needs. With its advanced Cognitive Actions, Xiaomicar offers developers a seamless way to integrate custom image generation into their applications, significantly speeding up the design process and enhancing creativity.
Whether you're building marketing materials, designing user interfaces, or creating unique visual content for social media, Xiaomicar provides the tools you need to bring your ideas to life. By leveraging customizable parameters such as inpainting, aspect ratios, and image quality, you can produce stunning visuals that stand out.
Prerequisites
To get started, you'll need a Cognitive Actions API key and a basic understanding of how to make API calls. Once you have these, you'll be ready to harness the power of Xiaomicar’s image generation capabilities.
Generate Custom Image
The Generate Custom Image action is designed to create hyper-realistic images based on user-defined parameters. Whether you're looking to generate an image from a prompt or modify an existing image through inpainting, this action provides flexibility and high-quality results.
Purpose
This action solves the problem of needing unique, high-quality images quickly. Instead of relying on stock images or lengthy design processes, developers can utilize this action to generate tailored visuals that meet their specific requirements.
Input Requirements
To use this action, you will need to provide a structured input, including:
- prompt: A description of the image you want to generate (required).
- model: Choose between "dev" for detailed images or "schnell" for faster generation.
- aspectRatio: Define the aspect ratio of the generated image.
- outputCount: Specify the number of images to generate (maximum of 4).
- Additional parameters for fine-tuning image quality, guidance scale, and more.
Expected Output
The expected output will be URLs to the generated images in the specified format (e.g., webp, jpg, png). For example, the output may look like this:
https://assets.cognitiveactions.com/invocations/.../image1.webphttps://assets.cognitiveactions.com/invocations/.../image2.webp
Use Cases for this Specific Action
- Marketing Campaigns: Create eye-catching visuals for advertisements or social media posts that are tailored to specific themes or products.
- E-commerce: Generate product images that highlight features and appeal to customers without the need for extensive photo shoots.
- Content Creation: Develop unique illustrations for blogs, articles, or educational materials that enhance reader engagement.
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 = "3c83494a-6da8-4e66-9376-db2cf1fdb7c7" # Action ID for: Generate Custom Image
# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
"model": "dev",
"prompt": "CINTHIA sitting inside her light blue xiaomicar as she drives it. The xiaomicar should be visible since this is an advertisement for xiaomicar. The image is hyper-realistic, with detailed textures. ",
"aspectRatio": "1:1",
"outputCount": 4,
"outputFormat": "webp",
"guidanceScale": 3.5,
"mainLoraScale": 1,
"outputQuality": 90,
"additionalLora": "darionaviar/cinthia",
"promptStrength": 0.8,
"additionalLoraScale": 0.6,
"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
Xiaomicar's Generate Custom Image action empowers developers to streamline their image creation process while ensuring high quality and customization. With flexible options for input and output, this action is an excellent choice for various applications, from marketing to content creation.
As you integrate this powerful tool into your projects, consider experimenting with different parameters to achieve the best results. Start generating stunning custom images today and elevate your visual content to new heights!