TryOn AI Python SDK
Use this SDK to interact with TryOn AI API. Integrate virtual try-on, model swap, outfit generation and captioning in your application.
Installation
pip install tryonai
Environment Variables
export TRYONAI_SERVER_URL=https://prod.server.tryonlabs.ai
export TRYONAI_EMAIL=your_email@example.com
export TRYONAI_PASSWORD=your_password
Usage
Get access token
from tryonai import get_access_token
# Get access token
access_token = get_access_token(email=os.getenv('TRYONAI_EMAIL'), password=os.getenv('TRYONAI_PASSWORD'))
print("access_token:", access_token)
Upload Image
from tryonai import upload_image
# Upload image
uploaded_image = upload_image(image_path="data/garment.jpg", data={"type": "garment", "gender": "male", "preprocess": "true"}, access_token=access_token)
print("uploaded_image:", uploaded_image)
Virtual Try On
from tryonai import perform_virtual_try_on
# Perform virtual try on
experiment = perform_virtual_try_on(garment_id=garment_id, person_id=person_id)
print("experiment:", experiment)
Model Swap
from tryonai import perform_model_swap
# Perform model swap
experiment = perform_model_swap(garment_id=garment_id, params={"prompt": "Indian male model with straight hair, blue eyes, round face, 4k resolution, high-resolution", "guidance_scale": 4.5, "num_inference_steps": 30, "seed":-1, "num_images": 3, "width":512, "height": 512})
print("experiment:", experiment)
Outfit Generation
from tryonai import generate_outfit
# Generate outfit
experiment = generate_outfit(params={"prompt": "A flat lay image of a T-shirt, round neck, blue color, high-resolution, 4k resolution", "height":256, "width": 256, "seed": -1, "guidance_scale": 4.5, "num_inference_steps": 20, "num_images_per_prompt": 2, "strength": 0.8})
print("experiment:", experiment)
Outfit Captioning
from tryonai import caption_outfit
# Caption outfit
experiment = caption_outfit(garment_id=garment_id, params={"output_format": "text"})
print("experiment:", experiment)
Get Experiment
from tryonai import get_experiment
# Get experiment
experiment = get_experiment(experiment_id=experiment_id)
print("experiment:", experiment)
Download Image
from tryonai import download_image
# Download image
download_image(image_url=experiment_result_image_url, image_path="data/result.png")
Metadata
Release files for tryonai 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tryonai-0.1.0.tar.gz | 3.6 kB | Without provenance | Details for tryonai-0.1.0.tar.gz |
Release files / tryonai-0.1.0.tar.gz
| Download URL | tryonai-0.1.0.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
311315309d114599c3d57f4bf4c54dd7f0697c922b89bfec0ba625f91eb9f4c6
|
|
BLAKE2b-256 checksum How to use checksums |
3855dfd1a371fe09655790aebdeac668ed7d92d8623be1a2d5a5ee8a7a6d7ea1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Security for tryonai 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.