Create Stunning Fashion Images with Clovia Blue Nightwear Cognitive Actions

23 Apr 2025
Create Stunning Fashion Images with Clovia Blue Nightwear Cognitive Actions

In the world of fashion e-commerce, the ability to create captivating visuals can significantly enhance your brand's appeal. The Clovia Blue Nightwear Cognitive Actions provide a powerful API for generating high-quality fashion images tailored to your specific needs. With customizable parameters, developers can leverage AI to produce stunning visuals for marketing, product listings, and more.

Prerequisites

Before diving into the integration of the Clovia Blue Nightwear Cognitive Actions, ensure you have the following:

  • API Key: You will need an API key for authentication to access the Cognitive Actions platform.
  • Basic Knowledge of JSON: The input and output for these actions are structured in JSON format, so familiarity with this format is essential.

Authentication is typically done by passing your API key in the headers of your requests.

Cognitive Actions Overview

Generate Fashion Image

The Generate Fashion Image action allows you to create fashion-related images using a customizable AI model. This action supports image-to-image transformation and inpainting, enabling you to specify parameters such as aspect ratio, image quality, and prompt strength. Developers can optimize for speed and improve realism through the application of LoRA (Low-Rank Adaptation).

Category: Image Generation

Input

The input for this action requires a JSON object with various parameters. Here’s a breakdown of the required and optional fields based on the input schema:

  • Required:
    • prompt: A text prompt guiding the image generation. (Example: "a female model wearing clovia-blue-nightwear nightwear, ecommerce photography, white background")
  • Optional:
    • mask: URL to the image mask for inpainting.
    • seed: Defines the random seed for reproducibility.
    • image: URL to the reference image for transformations.
    • model: Specifies the model for inference (options: dev, schnell).
    • width, height: Dimensions of the generated image (must meet certain criteria).
    • megapixels: Size of the image in megapixels.
    • aspectRatio: Desired aspect ratio of the image.
    • outputFormat: Format of the output image (options: webp, jpg, png).
    • guidanceScale, loraIntensity, outputQuality, and more to fine-tune the output.

Example Input:

{
  "model": "dev",
  "prompt": "a female model wearing clovia-blue-nightwear nightwear, ecommerce photography, white background",
  "megapixels": "1",
  "aspectRatio": "2:3",
  "outputFormat": "webp",
  "guidanceScale": 3,
  "loraIntensity": 1,
  "outputQuality": 80,
  "enableFastMode": false,
  "promptStrength": 0.8,
  "numberOfOutputs": 2,
  "inferenceStepsCount": 28,
  "additionalLoraIntensity": 1
}

Output

The output of this action is an array of URLs pointing to the generated images. Each link corresponds to a different output image based on the provided prompt and parameters.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/79a5479f-2c0a-441a-a150-6ada368c47c5/f197f8b9-7c97-492e-a396-39eb26a25a3c.webp",
  "https://assets.cognitiveactions.com/invocations/79a5479f-2c0a-441a-a150-6ada368c47c5/91f5e482-1473-4f19-9d57-b83688cb5fa3.webp"
]

Conceptual Usage Example (Python)

Here’s a conceptual Python code snippet illustrating how to invoke the Generate Fashion Image 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 = "16e52db4-7d9a-4b05-bfee-8f048e11be43"  # Action ID for Generate Fashion Image

# Construct the input payload based on the action's requirements
payload = {
    "model": "dev",
    "prompt": "a female model wearing clovia-blue-nightwear nightwear, ecommerce photography, white background",
    "megapixels": "1",
    "aspectRatio": "2:3",
    "outputFormat": "webp",
    "guidanceScale": 3,
    "loraIntensity": 1,
    "outputQuality": 80,
    "enableFastMode": False,
    "promptStrength": 0.8,
    "numberOfOutputs": 2,
    "inferenceStepsCount": 28,
    "additionalLoraIntensity": 1
}

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 code snippet, replace the placeholder values with your actual API key and endpoint. The action ID and input payload are structured to meet the requirements of the Generate Fashion Image action.

Conclusion

The Clovia Blue Nightwear Cognitive Actions offer powerful tools for generating high-quality fashion images tailored to your specifications. By integrating these actions into your applications, you can enhance your e-commerce visuals and create more engaging content. Explore the different parameters available to customize your outputs and take your fashion imagery to the next level!