Transform Your Fashion Creations with qiweiii/oot_diffusion_dc Cognitive Actions

21 Apr 2025
Transform Your Fashion Creations with qiweiii/oot_diffusion_dc Cognitive Actions

Integrating advanced image processing capabilities into applications can transform user experiences, particularly in the fashion industry. The qiweiii/oot_diffusion_dc spec offers a powerful Cognitive Action that enables developers to generate realistic fashion models complete with specified garments. This pre-built action simplifies the creation of visual content, allowing developers to focus on innovation rather than complex algorithms.

Prerequisites

Before diving into the Cognitive Actions, ensure you have:

  • An API key for accessing the Cognitive Actions platform.
  • A basic understanding of JSON structures and API interactions.

For authentication, you will typically pass your API key in the headers of your requests, enabling secure access to the Cognitive Actions endpoints.

Cognitive Actions Overview

Generate Fashion Model with Garment

The Generate Fashion Model with Garment action allows you to create a full-body fashion model adorned with a specified garment from given image URIs. This action provides customization options such as seed, inference steps, and guidance scale, which can be adjusted to control the reproducibility and diversity of the generated outcomes.

Input

The input schema for this action includes the following fields:

  • seed: (integer, optional) The random seed for result generation, influencing reproducibility. Defaults to 0.
  • steps: (integer, optional) The number of inference steps, affecting detail level and processing time. Ranges from 1 to 40, defaults to 20.
  • modelImage: (string, required) URI of the model image to be processed. This should be a clear image in URI format. Defaults to a sample model image URI.
  • garmentImage: (string, required) URI of the upper body garment image. This should also be in URI format. Defaults to a sample garment image URI.
  • guidanceScale: (number, optional) A scale guiding the processing strength, influencing variation. Must be between 1 and 5, defaults to 2.
  • garmentCategory: (string, optional) Specifies the garment category: upperbody, lowerbody, or dress. Defaults to upperbody.

Example Input:

{
  "seed": 0,
  "steps": 15,
  "modelImage": "https://levihsu-ootdiffusion.hf.space/--replicas/eldt3/file=/tmp/gradio/aa9673ab8fa122b9c5cdccf326e5f6fc244bc89b/model_8.png",
  "garmentImage": "https://levihsu-ootdiffusion.hf.space/--replicas/eldt3/file=/tmp/gradio/a54a0d00053a867f9380b6ec6de1e3c40ee1b2fa/051517_1.jpg",
  "guidanceScale": 2,
  "garmentCategory": "lowerbody"
}

Output

The output will include an array of URIs that link to the generated images of the fashion model with the specified garment.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/6684e45d-b372-4819-9e46-438af41d27fc/5c8e9ebc-2fa5-4cdf-966b-48c558966b84.png",
  "https://assets.cognitiveactions.com/invocations/6684e45d-b372-4819-9e46-438af41d27fc/3e7a0436-036e-4133-8ed2-9e62e9b28158.png",
  "https://assets.cognitiveactions.com/invocations/6684e45d-b372-4819-9e46-438af41d27fc/f56a5f61-83f0-4c29-834a-3e0d21731a02.png",
  "https://assets.cognitiveactions.com/invocations/6684e45d-b372-4819-9e46-438af41d27fc/b89fde43-ffb4-4151-8c7b-6378824a2139.png"
]

Conceptual Usage Example (Python)

Here’s a conceptual example of how you might call the Generate Fashion Model with Garment action using Python:

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 = "7346e0e6-d80c-4b0c-b5c9-0c654b71c009" # Action ID for Generate Fashion Model with Garment

# Construct the input payload based on the action's requirements
payload = {
    "seed": 0,
    "steps": 15,
    "modelImage": "https://levihsu-ootdiffusion.hf.space/--replicas/eldt3/file=/tmp/gradio/aa9673ab8fa122b9c5cdccf326e5f6fc244bc89b/model_8.png",
    "garmentImage": "https://levihsu-ootdiffusion.hf.space/--replicas/eldt3/file=/tmp/gradio/a54a0d00053a867f9380b6ec6de1e3c40ee1b2fa/051517_1.jpg",
    "guidanceScale": 2,
    "garmentCategory": "lowerbody"
}

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, you replace the placeholder for the API key with your actual key and specify the action ID. The input payload is constructed as per the required schema, which includes URIs for the model and garment images. The endpoint URL and request structure shown are illustrative and may differ in actual use.

Conclusion

The qiweiii/oot_diffusion_dc Cognitive Action for generating fashion models with garments offers a streamlined approach for developers looking to enhance their applications with sophisticated image processing capabilities. By utilizing this action, you can create compelling visual content efficiently. Consider exploring additional use cases, like integrating this functionality into e-commerce platforms or fashion design tools, to fully leverage its potential.