Metadata-Version: 2.4
Name: tryon-tray
Version: 0.2.1
Summary: A package for virtual try-on services integration
Home-page: https://github.com/AlphaBake-TRI3D/Tryon-Bakery
Author: Nitish
Author-email: nitish@tri3d.in
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Requires-Dist: requests
Requires-Dist: python-dotenv
Requires-Dist: tqdm
Requires-Dist: pyjwt
Requires-Dist: replicate
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# Tryon-Tray

A Python package for virtual try-on services integration, supporting multiple VTON (Virtual Try-On)providers.


## Installation

```sh
pip install tryon-tray
```

## Usage

```python
# Load environment variables

from dotenv import load_dotenv
from tryon_tray.vton_api import VTON
from datetime import datetime
load_dotenv()
model_image = "inputs/person.jpg"
garment_image = "inputs/garment.jpeg"

#model_list = ["fashnai", "klingai", "replicate", "alphabake"] 
result = VTON(
    model_image=model_image,
    garment_image=garment_image,
    model_name="fashnai", 
    auto_download=True,
    download_path="result.jpg",
    show_polling_progress=True,
    # Optional parameters
    category="tops",
    mode="quality",
)

print("Time taken: ",result['timing']['time_taken'])
```

### Alphabake Example

```python
# 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_path')}")
print(f"Time taken: {result['timing']['time_taken']}")
```

## Features

- Multiple VTON service providers support  
- Automatic image downloading   
- Progress tracking 

## Configuration

Create a .env file with your API keys:

```sh
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


```python
{
  "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 image  
- `garment_image`: Path to the garment image  
- `model_name`: Service provider ("fashnai", "klingai", "replicate", "alphabake") 
- `auto_download`: Automatically download generated images  
- `download_dir`: Directory for downloaded images  
- `polling_interval`: Time between status checks (seconds)`
- `show_polling_progress`: Show progressbar during generation   
- `category`: 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 output  
- `restore_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.
