Create Stunning Fashion Images Using the AI FrenchDress Model

In the ever-evolving world of fashion and design, creating visually appealing images is crucial for marketing and presentation. The AI FrenchDress model, part of the tiziisa93/ai-frenchdress API, empowers developers to generate high-quality inpainted images using customizable prompts and settings. This article delves into the capabilities of this Cognitive Action, helping you understand how to seamlessly integrate it into your applications.
Prerequisites
Before you get started, make sure you have the following:
- An API key to access the Cognitive Actions platform.
- Basic understanding of JSON and HTTP requests.
To authenticate your requests, you will typically include your API key in the headers of your HTTP requests, ensuring secure access to the Cognitive Actions you wish to use.
Cognitive Actions Overview
Generate Inpainted Image with AI FrenchDress Model
The Generate Inpainted Image with AI FrenchDress Model action allows you to create inpainted images based on a specified prompt and various customizable options. This action is categorized under image-generation and offers flexibility in output quality, aspect ratios, and additional parameters to fine-tune the generated images.
Input
The input schema for this action requires the following fields:
- prompt (required): A descriptive text guiding the image generation process.
- mask (optional): URI of the image mask for inpainting.
- image (optional): URI of the input image for inpainting or image-to-image mode.
- model (optional): Specifies the model for inference (
devorschnell). - width (optional): Width of the generated image (256 to 1440 pixels).
- height (optional): Height of the generated image (256 to 1440 pixels).
- aspectRatio (optional): Determines the aspect ratio (various options including
1:1,custom, etc.). - outputFormat (optional): Format of the output image (
webp,jpg,png). - guidanceScale (optional): Guidance scale for image realism (0 to 10).
- outputQuality (optional): Quality setting for the output image (0 to 100).
- numberOfOutputs (optional): Number of images to generate (1 to 4).
- additional parameters: Includes settings like
loraScale,accelerateMode, and more.
Here is an example of the JSON payload you would need to provide:
{
"model": "dev",
"prompt": "cream white ai-frenchdress worn by a pregnant model, maxi length, long sleeves, photo studio background.\n\nA vintage-inspired rib-knit dress in ivory or off-white, featuring long sleeves with pearl button accents near the cuffs...",
"loraScale": 1,
"aspectRatio": "4:5",
"outputFormat": "png",
"guidanceScale": 3,
"outputQuality": 80,
"accelerateMode": false,
"promptStrength": 0.8,
"numberOfOutputs": 1,
"additionalLoraScale": 1,
"approximateMegapixels": "1",
"numberOfInferenceSteps": 28
}
Output
Upon successful execution, the action typically returns a URL to the generated image. For example:
[
"https://assets.cognitiveactions.com/invocations/8c41862a-f77f-49e0-953b-e04051c37393/26022008-bc7c-408a-8a05-c460a069a673.png"
]
Conceptual Usage Example (Python)
Here’s an illustrative Python snippet demonstrating how you could call the Cognitive Actions execution endpoint for this action:
import requests
import json
# Replace with your Cognitive Actions API key and endpoint
COGNITIVE_ACTIONS_API_KEY = "YOUR_COGNITIVE_ACTIONS_API_KEY"
COGNITIVE_ACTIONS_EXECUTE_URL = "https://api.cognitiveactions.com/actions/execute" # Hypothetical endpoint
action_id = "e8bda88d-d635-42bc-b75b-63b9af41987e" # Action ID for Generate Inpainted Image with AI FrenchDress Model
# Construct the input payload based on the action's requirements
payload = {
"model": "dev",
"prompt": "cream white ai-frenchdress worn by a pregnant model, maxi length, long sleeves, photo studio background.\n\nA vintage-inspired rib-knit dress in ivory or off-white, featuring long sleeves with pearl button accents near the cuffs...",
"loraScale": 1,
"aspectRatio": "4:5",
"outputFormat": "png",
"guidanceScale": 3,
"outputQuality": 80,
"accelerateMode": False,
"promptStrength": 0.8,
"numberOfOutputs": 1,
"additionalLoraScale": 1,
"approximateMegapixels": "1",
"numberOfInferenceSteps": 28
}
headers = {
"Authorization": f"Bearer {COGNITIVE_ACTIONS_API_KEY}",
"Content-Type": "application/json"
}
try:
response = requests.post(
COGNITIVE_ACTIONS_EXECUTE_URL,
headers=headers,
json={"action_id": action_id, "inputs": payload} # Hypothetical structure
)
response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx)
result = response.json()
print("Action executed successfully:")
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: {e.response.text}")
In this example, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The payload must be structured according to the input schema outlined earlier, and the endpoint URL is illustrative.
Conclusion
The AI FrenchDress model provides developers with a powerful tool for creating high-quality fashion images through customizable prompts and settings. By integrating this Cognitive Action into your applications, you can enhance visual content, streamline workflows, and unlock new creative possibilities. Explore the various parameters and experiment with different settings to achieve the desired results for your projects!