Virtual Try-On API

Generate

Initiate a new try-on generation.

POST https://vto.face-swap.co/run

Request

Python
cURL
JavaScript
import requests response = requests.post( "https://vto.face-swap.co/run", headers={"Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json"}, json={ "model_image": "https://huggingface.co/spaces/tonyassi/Virtual-Try-On-Pro/resolve/main/examples/kim1.jpg", "garment_image": "https://huggingface.co/spaces/tonyassi/Virtual-Try-On-Pro/resolve/main/examples/kim2.jpg", "category": "one-pieces", }, )
curl -X POST https://vto.face-swap.co/run \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY_HERE" \ -d '{ "model_image": "https://huggingface.co/spaces/tonyassi/Virtual-Try-On-Pro/resolve/main/examples/kim1.jpg", "garment_image": "https://huggingface.co/spaces/tonyassi/Virtual-Try-On-Pro/resolve/main/examples/kim2.jpg", "category": "one-pieces" }'
fetch('https://vto.face-swap.co/run', { method: 'POST', body: JSON.stringify({ model_image: "https://huggingface.co/spaces/tonyassi/Virtual-Try-On-Pro/resolve/main/examples/kim1.jpg", garment_image: "https://huggingface.co/spaces/tonyassi/Virtual-Try-On-Pro/resolve/main/examples/kim2.jpg", category: "one-pieces" }), headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json', } });

Properties:

model_image Required
image URL | base64
garment_image Required
image URL | base64
category Required
'one-pieces' | 'tops' | 'bottoms'

The category specifies the type of garment. Choose from 'one-pieces' for full outfits, dresses, and jumpsuits. 'tops' for upper body garments, shirts and jackets.'bottoms' for lower body items, skirts, and pants.

Response

200

The reponse will return the id of the prediction which you will need to use for getting the status and result.

{ "id": "123a87r9-4129-4bb3-be18-9c9fb5bd7fc1-u1", "error": null }

Status

Receive the status of the generation by id.

GET https://vto.face-swap.co/status/:id

Request

Python
cURL
JavaScript
import requests response = requests.get( "https://vto.face-swap.co/status/123a87r9-4129-4bb3-be18-9c9fb5bd7fc1-u1", headers={"Authorization": "Bearer YOUR_API_KEY"}, )
curl -X GET https://vto.face-swap.co/status/123a87r9-4129-4bb3-be18-9c9fb5bd7fc1-u1 \ -H "Authorization: Bearer YOUR_API_KEY_HERE"
fetch('https://vto.face-swap.co/status/123a87r9-4129-4bb3-be18-9c9fb5bd7fc1-u1', { method: 'GET', headers: { 'Authorization': 'Bearer YOUR_API_KEY', } });

Response

The response will return the prediction id and status.

Status types can be one of the following:

status
starting | in_queue | processing | completed | failed
200

Prediction in progress

{ "id": "123a87r9-4129-4bb3-be18-9c9fb5bd7fc1-u1", "status": "processing", "error": null }
200

Prediction completed

{ "id": "123a87r9-4129-4bb3-be18-9c9fb5bd7fc1-u1", "status": "completed", "output": [ "https://cdn.staging/123a87r9-4129-4bb3-be18-9c9fb5bd7fc1-u1/output_0.png" ], "error": null }

Get Credits

Get the number of remaining credits.

GET https://vto.face-swap.co/get_credits/:YOUR_API_KEY

Request

Python
cURL
JavaScript
import requests response = requests.get( "https://vto.face-swap.co/get_credits/YOUR_API_KEY" )
curl -X GET https://vto.face-swap.co/get_credits/YOUR_API_KEY
fetch('https://vto.face-swap.co/get_credits/YOUR_API_KEY', { method: 'GET', });

Response

The response will be your key and number of reamining credits.

200
{ "key": "YOUR_API_KEY", "credits": "99", }