A package for virtual try-on services integration
Project description
Tryon-Tray
A Python package for virtual try-on services integration, supporting multiple VTON (Virtual Try-On)providers.
Installation
pip install tryon-tray
Usage
# Using Alphabake's virtual try-on API
from dotenv import load_dotenv
from tryon_tray.vton_api import VTON
load_dotenv()
result = VTON(
model_image="inputs/person.jpg",
garment_image="inputs/garment.jpeg",
model_name="alphabake",
auto_download=True,
download_path="result_alphabake.png",
show_polling_progress=True,
# Alphabake specific parameters
mode="balanced", # Options: 'fast', 'balanced', or 'quality'
garment_name="garment-example",
tryon_name="tryon-example"
)
print(f"Result saved to: {result.get('local_paths')}")
print(f"Time taken: {result['timing']['time_taken']}")
Exploring Available Models
# Discover available models and their parameters
from tryon_tray import get_available_models, get_model_params, get_model_sample_config
# List all available models
all_models = get_available_models()
print("Available models:", all_models)
# List just the virtual try-on models
vton_models = get_available_models(category="vton")
print("VTON models:", vton_models)
# List video models
video_models = get_available_models(category="video")
print("Video models:", video_models)
# Get parameters for a specific model
alphabake_params = get_model_params("alphabake")
print("Alphabake parameters:", alphabake_params)
# Get a sample configuration for a model
sample_config = get_model_sample_config("klingai")
print("Sample KlingAI config:", sample_config)
# Use the sample config directly
from dotenv import load_dotenv
from tryon_tray import VTON
load_dotenv()
config = get_model_sample_config("fashnai")
result = VTON(model_name="fashnai", **config)
Features
- Multiple VTON service providers support
- Automatic image downloading
- Progress tracking
- Model discovery and parameter exploration
Configuration
Create a .env file with your API keys:
FASHNAI_API_KEY=your_fashnai_key
KLINGAI_API_KEY=your_klingai_key
REPLICATE_API_TOKEN=your_replicate_token
ALPHABAKE_API_KEY=your_alphabake_key
Sample Response
{
"urls": ["https:/..."], // Generated image URLs
"local_paths": ["path/to/downloaded/image.jpg"], // Downloaded file paths
"timing": {
"time_taken": datetime.timedelta // Total processing time
}
}
Parameters
model_image
: Path to the person/model imagegarment_image
: Path to the garment imagemodel_name
: Service provider ("fashnai", "klingai", "replicate", "alphabake")auto_download
: Automatically download generated imagesdownload_dir
: Directory for downloaded imagespolling_interval
: Time between status checks (seconds)`show_polling_progress
: Show progressbar during generationcategory
: Garment category ("tops", "dresses", etc.)mode
: Generation mode ("quality" or "speed" for most APIs, "fast"/"balanced"/"quality" for alphabake)adjust_hands
: Adjust hand positions in outputrestore_background
: Preserve original image background
Response Format
- URLs! for generated images
- Local paths! to downloaded images
- *Timing! information (time taken for processing)
License
MIT License
Contributing
Contributions are wellcome! Please feel free to submit a Pull Request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tryon_tray-0.2.4.1.tar.gz
(21.8 kB
view details)
Built Distribution
File details
Details for the file tryon_tray-0.2.4.1.tar.gz
.
File metadata
- Download URL: tryon_tray-0.2.4.1.tar.gz
- Upload date:
- Size: 21.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
8c1bc55c9dc596fde0ad229820ba5433afa08f2f418b15c4aee3255ad016a7a7
|
|
MD5 |
8568872eae17fb2f9ed7ed26a1ddc128
|
|
BLAKE2b-256 |
c2320115dc3459e331e18399bc330bd10578d7ba4554a9ead84975991f238040
|
File details
Details for the file tryon_tray-0.2.4.1-py3-none-any.whl
.
File metadata
- Download URL: tryon_tray-0.2.4.1-py3-none-any.whl
- Upload date:
- Size: 32.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
491c62c5fec482a33131328a25e4c66e7dac06159ac3814d47968461159f7730
|
|
MD5 |
0877fd19cf3b81f3436dbb4dc11f7a33
|
|
BLAKE2b-256 |
f29b2965330237c1ab243c95876a96804367ae5ddd61bfe64cf2b163ac368a0e
|