Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Virtual Clothing Try-On sample

Reproduces the 5.2 Virtual Clothing Try-On example from the OpenAI cookbook Image generation models prompting guide.

Given a photo of a person and separate garment images, the model edits the photo to dress the person in those garments — keeping their face, body, pose, and the background unchanged, and altering only the clothing.

Contents

Path Description
input_images/woman_in_museum.png Base photo — the person being dressed
input_images/tank_top.png Garment: tank top
input_images/jacket.png Garment: jacket
input_images/boots.png Garment: boots
virtual_tryon.py Runnable script that calls client.images.edit(...)
output_images/ Created at runtime; the result lands here

Input images were downloaded from the cookbook's source repo (openai/openai-cookbook, images/input_images/).

Run it

pip install openai
export OPENAI_API_KEY=sk-...        # PowerShell: $env:OPENAI_API_KEY="sk-..."
python virtual_tryon.py

Result is written to output_images/outfit_gpt-image-2.png.

Notes

  • The garment tank_top.png is passed twice in the image=[...] list, matching the cookbook. Repeating a reference reinforces it.
  • The script uses model gpt-image-2 as in the guide. If that model isn't enabled on your account, change it to gpt-image-1 in virtual_tryon.py.
  • The whole technique hinges on the prompt explicitly locking the invariants (identity, pose, background) and permitting change only to the clothing.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages