Louu007 commited on
Commit
683ce8c
·
verified ·
1 Parent(s): a031cbb

Upload 72 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +64 -0
  2. README.md +91 -6
  3. __pycache__/try_on_diffusion_client.cpython-313.pyc +0 -0
  4. __pycache__/try_on_diffusion_client.cpython-39.pyc +0 -0
  5. app.py +273 -0
  6. docs/API.md +341 -0
  7. docs/images/accessory_result_01.jpg +3 -0
  8. docs/images/avatar_image_01.jpg +3 -0
  9. docs/images/avatar_image_02.jpg +3 -0
  10. docs/images/avatar_image_03.jpg +3 -0
  11. docs/images/avatar_image_04.jpg +3 -0
  12. docs/images/avatar_modification_result_01.jpg +3 -0
  13. docs/images/avatar_modification_result_02.jpg +3 -0
  14. docs/images/avatar_prompt_result_01.jpg +3 -0
  15. docs/images/avatar_prompt_result_02.jpg +3 -0
  16. docs/images/avatar_prompt_result_03.jpg +3 -0
  17. docs/images/background_image_01.jpg +3 -0
  18. docs/images/background_image_02.jpg +3 -0
  19. docs/images/background_image_03.jpg +3 -0
  20. docs/images/background_image_04.jpg +3 -0
  21. docs/images/clothing_image_01.jpg +3 -0
  22. docs/images/clothing_image_02.jpg +3 -0
  23. docs/images/clothing_image_03.jpg +3 -0
  24. docs/images/clothing_image_04.jpg +3 -0
  25. docs/images/clothing_prompt_result_01.jpg +3 -0
  26. docs/images/clothing_prompt_result_02.jpg +3 -0
  27. docs/images/image_based_background_result_01.jpg +3 -0
  28. docs/images/image_based_background_result_02.jpg +3 -0
  29. docs/images/image_based_result_01.jpg +3 -0
  30. docs/images/new_background_result_01.jpg +3 -0
  31. docs/images/same_crop_result_01.jpg +3 -0
  32. docs/images/same_crop_result_02.jpg +3 -0
  33. docs/images/txt2img_result_01.jpg +3 -0
  34. docs/images/txt2img_result_02.jpg +3 -0
  35. examples/avatar/female_01.jpg +3 -0
  36. examples/avatar/female_02.jpg +3 -0
  37. examples/avatar/female_03.jpg +3 -0
  38. examples/avatar/female_04.jpg +3 -0
  39. examples/avatar/female_05.jpg +3 -0
  40. examples/avatar/female_06.jpg +3 -0
  41. examples/avatar/male_01.jpg +3 -0
  42. examples/avatar/male_02.jpg +3 -0
  43. examples/avatar/male_03.jpg +3 -0
  44. examples/avatar/male_04.jpg +3 -0
  45. examples/avatar/male_05.jpg +3 -0
  46. examples/avatar/male_06.jpg +3 -0
  47. examples/background/01.jpg +3 -0
  48. examples/background/02.jpg +3 -0
  49. examples/background/03.jpg +3 -0
  50. examples/background/04.jpg +3 -0
.gitattributes CHANGED
@@ -33,3 +33,67 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ docs/images/accessory_result_01.jpg filter=lfs diff=lfs merge=lfs -text
37
+ docs/images/avatar_image_01.jpg filter=lfs diff=lfs merge=lfs -text
38
+ docs/images/avatar_image_02.jpg filter=lfs diff=lfs merge=lfs -text
39
+ docs/images/avatar_image_03.jpg filter=lfs diff=lfs merge=lfs -text
40
+ docs/images/avatar_image_04.jpg filter=lfs diff=lfs merge=lfs -text
41
+ docs/images/avatar_modification_result_01.jpg filter=lfs diff=lfs merge=lfs -text
42
+ docs/images/avatar_modification_result_02.jpg filter=lfs diff=lfs merge=lfs -text
43
+ docs/images/avatar_prompt_result_01.jpg filter=lfs diff=lfs merge=lfs -text
44
+ docs/images/avatar_prompt_result_02.jpg filter=lfs diff=lfs merge=lfs -text
45
+ docs/images/avatar_prompt_result_03.jpg filter=lfs diff=lfs merge=lfs -text
46
+ docs/images/background_image_01.jpg filter=lfs diff=lfs merge=lfs -text
47
+ docs/images/background_image_02.jpg filter=lfs diff=lfs merge=lfs -text
48
+ docs/images/background_image_03.jpg filter=lfs diff=lfs merge=lfs -text
49
+ docs/images/background_image_04.jpg filter=lfs diff=lfs merge=lfs -text
50
+ docs/images/clothing_image_01.jpg filter=lfs diff=lfs merge=lfs -text
51
+ docs/images/clothing_image_02.jpg filter=lfs diff=lfs merge=lfs -text
52
+ docs/images/clothing_image_03.jpg filter=lfs diff=lfs merge=lfs -text
53
+ docs/images/clothing_image_04.jpg filter=lfs diff=lfs merge=lfs -text
54
+ docs/images/clothing_prompt_result_01.jpg filter=lfs diff=lfs merge=lfs -text
55
+ docs/images/clothing_prompt_result_02.jpg filter=lfs diff=lfs merge=lfs -text
56
+ docs/images/image_based_background_result_01.jpg filter=lfs diff=lfs merge=lfs -text
57
+ docs/images/image_based_background_result_02.jpg filter=lfs diff=lfs merge=lfs -text
58
+ docs/images/image_based_result_01.jpg filter=lfs diff=lfs merge=lfs -text
59
+ docs/images/new_background_result_01.jpg filter=lfs diff=lfs merge=lfs -text
60
+ docs/images/same_crop_result_01.jpg filter=lfs diff=lfs merge=lfs -text
61
+ docs/images/same_crop_result_02.jpg filter=lfs diff=lfs merge=lfs -text
62
+ docs/images/txt2img_result_01.jpg filter=lfs diff=lfs merge=lfs -text
63
+ docs/images/txt2img_result_02.jpg filter=lfs diff=lfs merge=lfs -text
64
+ examples/avatar/female_01.jpg filter=lfs diff=lfs merge=lfs -text
65
+ examples/avatar/female_02.jpg filter=lfs diff=lfs merge=lfs -text
66
+ examples/avatar/female_03.jpg filter=lfs diff=lfs merge=lfs -text
67
+ examples/avatar/female_04.jpg filter=lfs diff=lfs merge=lfs -text
68
+ examples/avatar/female_05.jpg filter=lfs diff=lfs merge=lfs -text
69
+ examples/avatar/female_06.jpg filter=lfs diff=lfs merge=lfs -text
70
+ examples/avatar/male_01.jpg filter=lfs diff=lfs merge=lfs -text
71
+ examples/avatar/male_02.jpg filter=lfs diff=lfs merge=lfs -text
72
+ examples/avatar/male_03.jpg filter=lfs diff=lfs merge=lfs -text
73
+ examples/avatar/male_04.jpg filter=lfs diff=lfs merge=lfs -text
74
+ examples/avatar/male_05.jpg filter=lfs diff=lfs merge=lfs -text
75
+ examples/avatar/male_06.jpg filter=lfs diff=lfs merge=lfs -text
76
+ examples/background/01.jpg filter=lfs diff=lfs merge=lfs -text
77
+ examples/background/02.jpg filter=lfs diff=lfs merge=lfs -text
78
+ examples/background/03.jpg filter=lfs diff=lfs merge=lfs -text
79
+ examples/background/04.jpg filter=lfs diff=lfs merge=lfs -text
80
+ examples/background/05.jpg filter=lfs diff=lfs merge=lfs -text
81
+ examples/background/06.jpg filter=lfs diff=lfs merge=lfs -text
82
+ examples/background/07.jpg filter=lfs diff=lfs merge=lfs -text
83
+ examples/background/08.jpg filter=lfs diff=lfs merge=lfs -text
84
+ examples/background/09.jpg filter=lfs diff=lfs merge=lfs -text
85
+ examples/background/10.jpg filter=lfs diff=lfs merge=lfs -text
86
+ examples/background/11.jpg filter=lfs diff=lfs merge=lfs -text
87
+ examples/background/12.jpg filter=lfs diff=lfs merge=lfs -text
88
+ examples/clothing/female_01.jpg filter=lfs diff=lfs merge=lfs -text
89
+ examples/clothing/female_02.jpg filter=lfs diff=lfs merge=lfs -text
90
+ examples/clothing/female_03.jpg filter=lfs diff=lfs merge=lfs -text
91
+ examples/clothing/female_04.jpg filter=lfs diff=lfs merge=lfs -text
92
+ examples/clothing/female_05.jpg filter=lfs diff=lfs merge=lfs -text
93
+ examples/clothing/female_06.jpg filter=lfs diff=lfs merge=lfs -text
94
+ examples/clothing/male_01.jpg filter=lfs diff=lfs merge=lfs -text
95
+ examples/clothing/male_02.jpg filter=lfs diff=lfs merge=lfs -text
96
+ examples/clothing/male_03.jpg filter=lfs diff=lfs merge=lfs -text
97
+ examples/clothing/male_04.jpg filter=lfs diff=lfs merge=lfs -text
98
+ examples/clothing/male_05.jpg filter=lfs diff=lfs merge=lfs -text
99
+ examples/clothing/male_06.jpg filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,12 +1,97 @@
 
1
  ---
2
- title: Virtual Saree Try On
3
- emoji: 🌖
4
- colorFrom: red
5
- colorTo: green
6
  sdk: gradio
7
- sdk_version: 5.15.0
8
  app_file: app.py
9
  pinned: false
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
+
2
  ---
3
+ title: Virtual Try-On Diffusion IEEE Dressify
4
+ emoji: 👗
5
+ colorFrom: indigo
6
+ colorTo: purple
7
  sdk: gradio
8
+ sdk_version: 5.6.0
9
  app_file: app.py
10
  pinned: false
11
+ short_description: Diffusion-based multi-modal virtual try-on pipeline demo.
12
+ tags:
13
+ - virtual try-on
14
+ - vton
15
+ - clothing transfer
16
+ - diffusion
17
+ - img2img
18
+ - txt2img
19
+ ---
20
+
21
+ # Virtual Try-On Diffusion [VTON-D] by IEEE Dressify
22
+
23
+ Virtual Try-On Diffusion [VTON-D] by Dressify is a custom diffusion-based pipeline designed for fast and flexible multi-modal virtual try-on. This system enables tasks such as clothing transfer, avatar replacement, fashion image generation, and more by using reference images or text prompts to specify clothing, avatar, and background.
24
+
25
+ ---
26
+
27
+ ## Installation
28
+
29
+ ### 1. Clone the Repository
30
+ ```bash
31
+ git clone https://github.com/Louay0007/Virtual-Try-On-Dressify.git
32
+ cd Virtual-Try-On-Dressify
33
+ ```
34
+
35
+ ### 2. Create a Virtual Environment
36
+ ```bash
37
+ python -m venv venv
38
+ ```
39
+
40
+ ### 3. Activate the Virtual Environment
41
+ - **Windows**:
42
+ ```bash
43
+ venv\Scripts\activate
44
+ ```
45
+ - **macOS/Linux**:
46
+ ```bash
47
+ source venv/bin/activate
48
+ ```
49
+
50
+ ### 4. Install Dependencies
51
+ ```bash
52
+ pip install -r requirements.txt
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Usage
58
+
59
+ ### 1. Run the Application
60
+ ```bash
61
+ python app.py
62
+ ```
63
+
64
+ ### 2. Access the Application
65
+ Open your browser and navigate to:
66
+ ```
67
+ http://127.0.0.1:7860
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Features
73
+
74
+ - **Clothing Transfer**: Transfer garments between avatars with precision.
75
+ - **Avatar Replacement**: Easily switch between different avatars.
76
+ - **Fashion Image Generation**: Generate new fashion images based on reference images or text descriptions.
77
+ - **Multi-Modal Input**: Use text prompts or images for customization.
78
+
79
+ ---
80
+
81
+ ## Tags
82
+
83
+ - Virtual Try-On
84
+ - VTON
85
+ - Clothing Transfer
86
+ - Diffusion
87
+ - Image-to-Image (img2img)
88
+ - Text-to-Image (txt2img)
89
+
90
+ ---
91
+
92
+ ## Demos Version
93
+
94
+ - [🤗](https://huggingface.co/spaces/Louu007/ISSATM-VTO)
95
  ---
96
 
97
+ This project is a personal one
__pycache__/try_on_diffusion_client.cpython-313.pyc ADDED
Binary file (6.57 kB). View file
 
__pycache__/try_on_diffusion_client.cpython-39.pyc ADDED
Binary file (3.78 kB). View file
 
app.py ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import logging
2
+ import gradio as gr
3
+ import numpy as np
4
+ import cv2
5
+ import os
6
+ import base64
7
+
8
+ from try_on_diffusion_client import TryOnDiffusionClient
9
+
10
+ LOG_LEVEL = logging.INFO
11
+ LOG_FORMAT = "%(asctime)s %(thread)-8s %(name)-16s %(levelname)-8s %(message)s"
12
+ LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
13
+
14
+ EXAMPLE_PATH = os.path.join(os.path.dirname(__file__), "examples")
15
+
16
+ API_URL = os.getenv("TRY_ON_DIFFUSION_DEMO_API_URL", "https://try-on-diffusion.p.rapidapi.com")
17
+ API_KEY = os.getenv("TRY_ON_DIFFUSION_DEMO_API_KEY", "32815c8a07msh6a1cb1815af30cfp10ee85jsn177a64ac277f")
18
+
19
+ SHOW_RAPIDAPI_LINK = os.getenv("TRY_ON_DIFFUSION_DEMO_SHOW_RAPIDAPI_LINK", "1") == "1"
20
+
21
+ CONCURRENCY_LIMIT = int(os.getenv("TRY_ON_DIFFUSION_DEMO_CONCURRENCY_LIMIT", "2"))
22
+
23
+ logging.basicConfig(level=LOG_LEVEL, format=LOG_FORMAT, datefmt=LOG_DATE_FORMAT)
24
+
25
+ client = TryOnDiffusionClient(base_url=API_URL, api_key=API_KEY)
26
+
27
+
28
+ def get_image_base64(file_name: str) -> str:
29
+ _, ext = os.path.splitext(file_name.lower())
30
+
31
+ content_type = "image/jpeg"
32
+
33
+ if ext == ".png":
34
+ content_type = "image/png"
35
+ elif ext == ".webp":
36
+ content_type = "image/webp"
37
+ elif ext == ".gif":
38
+ content_type = "image/gif"
39
+
40
+ with open(file_name, "rb") as f:
41
+ return f"data:{content_type};base64," + base64.b64encode(f.read()).decode("utf-8")
42
+
43
+
44
+ def get_examples(example_dir: str) -> list[str]:
45
+ file_list = [f for f in os.listdir(os.path.join(EXAMPLE_PATH, example_dir)) if f.endswith(".jpg")]
46
+ file_list.sort()
47
+
48
+ return [os.path.join(EXAMPLE_PATH, example_dir, f) for f in file_list]
49
+
50
+
51
+ def try_on(
52
+ clothing_image: np.ndarray = None,
53
+ clothing_prompt: str = None,
54
+ avatar_image: np.ndarray = None,
55
+ avatar_prompt: str = None,
56
+ avatar_sex: str = None,
57
+ background_image: np.ndarray = None,
58
+ background_prompt: str = None,
59
+ seed: int = -1,
60
+ ) -> tuple:
61
+ result = client.try_on_file(
62
+ clothing_image=cv2.cvtColor(clothing_image, cv2.COLOR_RGB2BGR) if clothing_image is not None else None,
63
+ clothing_prompt=clothing_prompt,
64
+ avatar_image=cv2.cvtColor(avatar_image, cv2.COLOR_RGB2BGR) if avatar_image is not None else None,
65
+ avatar_prompt=avatar_prompt,
66
+ avatar_sex=avatar_sex if avatar_sex in ["male", "female"] else None,
67
+ background_image=cv2.cvtColor(background_image, cv2.COLOR_RGB2BGR) if background_image is not None else None,
68
+ background_prompt=background_prompt,
69
+ seed=seed,
70
+ )
71
+
72
+ if result.status_code == 200:
73
+ return cv2.cvtColor(result.image, cv2.COLOR_BGR2RGB), f"<h3>Success</h3><p>Seed: {result.seed}</p>"
74
+ else:
75
+ error_message = f"<h3>Error {result.status_code}</h3>"
76
+
77
+ if result.error_details is not None:
78
+ error_message += f"<p>{result.error_details}</p>"
79
+
80
+ return None, error_message
81
+
82
+
83
+ with gr.Blocks(theme=gr.themes.Soft(), delete_cache=(3600, 3600)) as app:
84
+ gr.HTML(
85
+ f"""
86
+ <div style="width: 100%; background-color: #001537; border-radius: 10px; padding-left: 10px">
87
+ <a href="https://www.ieee.org/" target="_blank">
88
+ <img src="{get_image_base64("images/logo.png")}" title=LOGO" alt="IEEE" style="float: left; margin-right: 10px; margin-left: -10px; border-radius: 10px; max-height: 50px;"/>
89
+ </a>
90
+ <h1 style="margin: 0; margin-right: 10px; line-height: 50px; color: #8cecd5; text-transform: uppercase">Dressify-Virtual Try ON TSYP</h1>
91
+ </div>
92
+ <br/>
93
+ <p>
94
+ Virtual Try On technology is developed by IEEE Dressify Members . We present This prototype
95
+ """
96
+ )
97
+
98
+
99
+
100
+ with gr.Row():
101
+ with gr.Column():
102
+ gr.HTML(
103
+ """
104
+ <h2>Clothing</h2>
105
+ <p>
106
+ Clothing may be specified with a reference image or a text prompt.
107
+ For more exotic use cases image and prompt can be also used together.
108
+ If both image and prompt are empty the model will generate random clothing.
109
+ <br/><br/>
110
+ </p>
111
+ """
112
+ )
113
+
114
+ with gr.Tab("Image"):
115
+ clothing_image = gr.Image(label="Clothing Image", sources=["upload"], type="numpy")
116
+
117
+ clothing_image_examples = gr.Examples(
118
+ inputs=clothing_image, examples_per_page=12, examples=get_examples("clothing")
119
+ )
120
+
121
+ with gr.Tab("Prompt"):
122
+ clothing_prompt = gr.TextArea(
123
+ label="Clothing Prompt",
124
+ info='Compel weighting <a href="https://github.com/damian0815/compel/blob/main/doc/syntax.md">syntax</a> is supported.',
125
+ )
126
+
127
+ clothing_prompt_examples = gr.Examples(
128
+ inputs=clothing_prompt,
129
+ examples_per_page=8,
130
+ examples=[
131
+ "a sheer blue sleeveless mini dress",
132
+ "a beige woolen sweater and white pleated skirt",
133
+ "a black leather jacket and dark blue slim-fit jeans",
134
+ "a floral pattern blouse and leggings",
135
+ "a paisley pattern purple shirt and beige chinos",
136
+ "a striped white and blue polo shirt and blue jeans",
137
+ "a colorful t-shirt and black shorts",
138
+ "a checked pattern shirt and dark blue cargo pants",
139
+ ],
140
+ )
141
+
142
+ with gr.Column():
143
+ gr.HTML(
144
+ """
145
+ <h2>Avatar</h2>
146
+ <p>
147
+ Avatar may be specified with a subject photo or a text prompt.
148
+ Latter can be used, for example, to replace person while preserving clothing.
149
+ For more exotic use cases image and prompt can be also used together.
150
+ If both image and prompt are empty the model will generate random avatars.
151
+ </p>
152
+ """
153
+ )
154
+
155
+ with gr.Tab("Image"):
156
+ avatar_image = gr.Image(label="Avatar Image", sources=["upload"], type="numpy")
157
+
158
+ avatar_image_examples = gr.Examples(
159
+ inputs=avatar_image,
160
+ examples_per_page=12,
161
+ examples=get_examples("avatar"),
162
+ )
163
+
164
+ with gr.Tab("Prompt"):
165
+ avatar_prompt = gr.TextArea(
166
+ label="Avatar Prompt",
167
+ info='Compel weighting <a href="https://github.com/damian0815/compel/blob/main/doc/syntax.md">syntax</a> is supported.',
168
+ )
169
+
170
+ avatar_prompt_examples = gr.Examples(
171
+ inputs=avatar_prompt,
172
+ examples_per_page=8,
173
+ examples=[
174
+ "a beautiful blond girl with long hair",
175
+ "a cute redhead girl with freckles",
176
+ "a plus size female model wearing sunglasses",
177
+ "a woman with dark hair and blue eyes",
178
+ "a fit man with dark beard and blue eyes",
179
+ "a young blond man posing for a photo",
180
+ "a gentleman with beard and mustache",
181
+ "a plus size man walking",
182
+ ],
183
+ )
184
+
185
+ avatar_sex = gr.Dropdown(
186
+ label="Avatar Sex",
187
+ choices=[("Auto", ""), ("Male", "male"), ("Female", "female")],
188
+ value="",
189
+ info="Avatar sex selector can be used to enforce a specific sex of the avatar.",
190
+ )
191
+
192
+ with gr.Column():
193
+ gr.HTML(
194
+ """
195
+ <h2>Background</h2>
196
+ <p>
197
+ Replacing background is optional.
198
+ Background may be specified with a reference image or a text prompt.
199
+ If omitted original avatar background will be preserved.
200
+ <br/><br/><br/>
201
+ </p>
202
+ """
203
+ )
204
+
205
+ with gr.Tab("Image"):
206
+ background_image = gr.Image(label="Background Image", sources=["upload"], type="numpy")
207
+
208
+ background_image_examples = gr.Examples(
209
+ inputs=background_image, examples_per_page=12, examples=get_examples("background")
210
+ )
211
+
212
+ with gr.Tab("Prompt"):
213
+ background_prompt = gr.TextArea(
214
+ label="Background Prompt",
215
+ info='Compel weighting <a href="https://github.com/damian0815/compel/blob/main/doc/syntax.md">syntax</a> is supported.',
216
+ )
217
+
218
+ background_prompt_examples = gr.Examples(
219
+ inputs=background_prompt,
220
+ examples_per_page=8,
221
+ examples=[
222
+ "in an autumn park",
223
+ "in front of a brick wall",
224
+ "near an old tree",
225
+ "on a busy city street",
226
+ "in front of a staircase",
227
+ "on an ocean beach with palm trees",
228
+ "in a shopping mall",
229
+ "in a modern office",
230
+ ],
231
+ )
232
+
233
+ with gr.Column():
234
+ gr.HTML(
235
+ """
236
+ <h2>Generation</h2>
237
+ """
238
+ )
239
+
240
+ seed = gr.Number(
241
+ label="Seed",
242
+ value=-1,
243
+ minimum=-1,
244
+ info="Seed used for generation, specify -1 for random seed for each generation.",
245
+ )
246
+
247
+ generate_button = gr.Button(value="Generate", variant="primary")
248
+
249
+ result_image = gr.Image(label="Result", show_share_button=False, format="jpeg")
250
+ result_details = gr.HTML(label="Details")
251
+
252
+ generate_button.click(
253
+ fn=try_on,
254
+ inputs=[
255
+ clothing_image,
256
+ clothing_prompt,
257
+ avatar_image,
258
+ avatar_prompt,
259
+ avatar_sex,
260
+ background_image,
261
+ background_prompt,
262
+ seed,
263
+ ],
264
+ outputs=[result_image, result_details],
265
+ api_name=False,
266
+ concurrency_limit=CONCURRENCY_LIMIT,
267
+ )
268
+
269
+ app.title = "Virtual Try-On Diffusion by IEEE Dressify"
270
+
271
+
272
+ if __name__ == "__main__":
273
+ app.queue(api_open=False).launch(show_api=False)
docs/API.md ADDED
@@ -0,0 +1,341 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Virtual Try-On Diffusion API
2
+
3
+ <!-- TOC -->
4
+ * [Virtual Try-On Diffusion API](#virtual-try-on-diffusion-api)
5
+ * [Summary](#summary)
6
+ * [Consuming the API](#consuming-the-api)
7
+ * [Try-On Endpoints](#try-on-endpoints)
8
+ * [Try-On Input Parameters](#try-on-input-parameters)
9
+ * [Clothing image](#clothing-image)
10
+ * [Clothing prompt](#clothing-prompt)
11
+ * [Avatar image](#avatar-image)
12
+ * [Avatar prompt](#avatar-prompt)
13
+ * [Background image](#background-image)
14
+ * [Background prompt](#background-prompt)
15
+ * [Additional notes](#additional-notes)
16
+ * [Try-On Output](#try-on-output)
17
+ * [Response codes](#response-codes)
18
+ * [NSFW content](#nsfw-content)
19
+ * [Use Cases and Recipes](#use-cases-and-recipes)
20
+ * [Image-based virtual try-on](#image-based-virtual-try-on)
21
+ * [Image-based virtual try-on with background](#image-based-virtual-try-on-with-background)
22
+ * [Avatar from a text prompt](#avatar-from-a-text-prompt)
23
+ * [Clothing from a text prompt](#clothing-from-a-text-prompt)
24
+ * [Modifying avatar's body](#modifying-avatars-body)
25
+ * [Txt2Img](#txt2img)
26
+ * [Other creative possibilities](#other-creative-possibilities)
27
+ * [Performance](#performance)
28
+ * [Known Issues and Limitations](#known-issues-and-limitations)
29
+ <!-- TOC -->
30
+
31
+ ## Summary
32
+
33
+ Virtual Try-On Diffusion [VTON-D] by [Texel.Moda](https://texelmoda.com) is a custom diffusion-based pipeline for fast
34
+ and flexible multi-modal virtual try-on. Clothing, avatar and background can be specified by reference images or text
35
+ prompts allowing for clothing transfer, avatar replacement, fashion image generation and other virtual try-on related
36
+ tasks. Check out the [demo on Hugging Face](https://huggingface.co/spaces/texelmoda/try-on-diffusion) to try the API in
37
+ a user-friendly way.
38
+
39
+ ## Consuming the API
40
+
41
+ The API is exposed through the RapidAPI Hub which manages API subscriptions, API keys, payments and other things. Please
42
+ refer to the [RapidAPI Documentation](https://docs.rapidapi.com/docs/consumer-quick-start-guide) to get started.
43
+
44
+ Generally, in order to use the API you need to perform the following steps:
45
+ - Create a RapidAPI.com account.
46
+ - [Navigate to the API page](https://rapidapi.com/texelmoda-texelmoda-apis/api/try-on-diffusion) and subscribe to a
47
+ suitable pricing plan. We also provide a free BASIC plan with 100 API requests per month.
48
+ - Use the obtained RapidAPI key to authenticate (via the _X-RapidAPI-Key_ header) and use the API from any programming
49
+ language or tool you like.
50
+
51
+ Example API call using cURL:
52
+ ```shell
53
+ curl --request POST \
54
+ --url https://try-on-diffusion.p.rapidapi.com/try-on-file \
55
+ --header 'Content-Type: multipart/form-data' \
56
+ --header 'x-rapidapi-host: try-on-diffusion.p.rapidapi.com' \
57
+ --header 'x-rapidapi-key: <RapidAPI Key>' \
58
+ --form clothing_image=1.jpg \
59
+ --form avatar_image=2.jpg
60
+ ```
61
+
62
+ For a simple Python client implementation please see the
63
+ [Hugging Face demo application source](https://huggingface.co/spaces/texelmoda/try-on-diffusion/blob/main/try_on_diffusion_client.py).
64
+
65
+ ## Try-On Endpoints
66
+
67
+ Try-On API consists of two endpoints that differ only in the method of passing reference images:
68
+
69
+ - **POST** _/try-on-file_ - takes reference images as uploaded files in the request body (using multipart/form-data).
70
+
71
+
72
+ - **POST** _/try-on-url_ - takes reference images as image URLs in POST parameters.
73
+
74
+ All image requirements, behavior and status codes are the same for both endpoints, choose the one that best suits your
75
+ application architecture.
76
+
77
+ ## Try-On Input Parameters
78
+
79
+ All input parameters for the try-on endpoints are currently optional. Images and prompts serve as additional generation
80
+ conditions and can even be used in combination. Below is the short parameter summary with links to extended information
81
+ on certain parameters.
82
+
83
+ List of input parameters for the **POST** _/try-on-file_ endpoint:
84
+
85
+ | Parameter | Description | Required |
86
+ |-----------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|
87
+ | [clothing_image](#clothing-image) | Clothing reference image in JPEG, PNG or WEBP format, maximum file size is 12 MB. | No |
88
+ | [clothing_prompt](#clothing-prompt) | Text prompt for clothing, can be used instead of an image. Compel weighting syntax is supported. Example: _red sleeveless mini dress_ | No |
89
+ | [avatar_image](#avatar-image) | Avatar image in JPEG, PNG or WEBP format, maximum file size is 12 MB. | No |
90
+ | avatar_sex | Avatar sex, either "male" or "female". Will be detected automatically, if left empty or omitted. Will enforce certain avatar sex if specified. | No |
91
+ | [avatar_prompt](#avatar-prompt) | Text prompt for the avatar, can be used instead of an image or with image to modify the avatar. Compel weighting syntax is supported. Example: _a gentleman with beard and mustache_ | No |
92
+ | [background_image](#background-image) | Optional background reference image in JPEG, PNG or WEBP format, maximum file size is 12 MB. Original avatar background is preserved if background is not specified. | No |
93
+ | [background_prompt](#background-prompt) | Optional background text prompt. Original avatar background is preserved if background is not specified. Example: _in an autumn park_ | No |
94
+ | seed | Seed for image generation. Default is -1 (random seed). Actual seed will also be output in the "X-Seed" response header. Example: _42_ | No |
95
+
96
+ List of input parameters for the **POST** _/try-on-url_ endpoint:
97
+
98
+ | Parameter | Description | Required |
99
+ |-------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|
100
+ | [clothing_image_url](#clothing-image) | Clothing reference image URL. Image should be in JPEG, PNG or WEBP format, maximum file size is 12 MB. | No |
101
+ | [clothing_prompt](#clothing-prompt) | Text prompt for clothing, can be used instead of an image. Compel weighting syntax is supported. Example: _red sleeveless mini dress_ | No |
102
+ | [avatar_image_url](#avatar-image) | Avatar image URL. Image should be in JPEG, PNG or WEBP format, maximum file size is 12 MB. | No |
103
+ | avatar_sex | Avatar sex, either "male" or "female". Will be detected automatically, if left empty or omitted. Will enforce certain avatar sex if specified. | No |
104
+ | [avatar_prompt](#avatar-prompt) | Text prompt for the avatar, can be used instead of an image or with image to modify the avatar. Compel weighting syntax is supported. Example: _a gentleman with beard and mustache_ | No |
105
+ | [background_image_url](#background-image) | Optional background reference image URL. Image should be in JPEG, PNG or WEBP format, maximum file size is 12 MB. Original avatar background is preserved if background is not specified. | No |
106
+ | [background_prompt](#background-prompt) | Optional background text prompt. Original avatar background is preserved if background is not specified. Example: _in an autumn park_ | No |
107
+ | seed | Seed for image generation. Default is -1 (random seed). Actual seed will also be output in the "X-Seed" response header. Example: _42_ | No |
108
+
109
+ ### Clothing image
110
+
111
+ For best results clothing reference images should meet a number of requirements:
112
+
113
+ - File format: **JPEG**, **PNG** or **WEBP**
114
+ - Maximum file size: **12 MB**
115
+ - Minimum image size: **256x256**
116
+ - Recommended image size: **768x1024 and above**
117
+ - Clothing should be **dressed on a person**. Some flat lay clothing photos might work, but currently it's not guaranteed
118
+ - **Single person** on the image (though multiple persons might also work)
119
+ - **Frontal** photo, though some degree of rotation is fine
120
+ - **Good lighting** conditions and **high image quality** as it directly affects the result
121
+ - **Minimal occlusion** by hair, hands or accessories
122
+
123
+ To summarize: the better is the clothing image the better is the final result.
124
+
125
+ Examples of good clothing images:
126
+
127
+ | <img src="images/clothing_image_01.jpg" width="240"> | <img src="images/clothing_image_02.jpg" width="240"> | <img src="images/clothing_image_03.jpg" width="240"> | <img src="images/clothing_image_04.jpg" width="240"> |
128
+ |------------------------------------------------------|------------------------------------------------------|------------------------------------------------------|------------------------------------------------------|
129
+
130
+ ### Clothing prompt
131
+
132
+ Instead of a clothing image you can use text prompt to describe the garment. Short and clear prompts work best.
133
+ Additionally, [Compel weighting syntax](https://github.com/damian0815/compel/blob/main/doc/syntax.md) is supported to
134
+ increase or decrease weight of certain tokens. Examples:
135
+ - _a sheer blue sleeveless mini dress_
136
+ - _a beige woolen sweater and white pleated skirt_
137
+ - _a black leather jacket and dark blue slim-fit jeans_
138
+ - _a floral pattern blouse and leggings_
139
+ - _a colorful+++ t-shirt and black shorts_
140
+
141
+ ### Avatar image
142
+
143
+ Avatar images should also meet a some requirements:
144
+
145
+ - File format: **JPEG**, **PNG** or **WEBP**
146
+ - Maximum file size: **12 MB**
147
+ - Minimum image size: **256x256**
148
+ - Recommended image size: **768x1024 and above**
149
+ - **Single person** on the image (though multiple persons might also work)
150
+ - **Frontal** photo, though some degree of rotation is fine
151
+ - **Good lighting** conditions and **high image quality**
152
+
153
+ Examples of good avatar images:
154
+
155
+ | <img src="images/avatar_image_01.jpg" width="240"> | <img src="images/avatar_image_02.jpg" width="240"> | <img src="images/avatar_image_03.jpg" width="240"> | <img src="images/avatar_image_04.jpg" width="240"> |
156
+ |----------------------------------------------------|----------------------------------------------------|----------------------------------------------------|----------------------------------------------------|
157
+
158
+ ### Avatar prompt
159
+
160
+ Instead of an avatar image you can use text prompt to describe the person. Short and clear prompts work best.
161
+ Additionally, [Compel weighting syntax](https://github.com/damian0815/compel/blob/main/doc/syntax.md) is supported to
162
+ increase or decrease weight of certain tokens. Examples:
163
+ - _a beautiful blond girl with long hair_
164
+ - _a cute redhead girl with freckles_
165
+ - _a (plus size)++ female model wearing sunglasses_
166
+ - _a fit man with dark beard and blue eyes_
167
+ - _a gentleman with beard and mustache_
168
+
169
+ ### Background image
170
+
171
+ Background images are used to extract high-level background features only and serve as a reference (and not exact
172
+ background). Below are basic image requirements:
173
+
174
+ - File format: **JPEG**, **PNG** or **WEBP**
175
+ - Maximum file size: **12 MB**
176
+ - Recommended image size: **256x256 and above**
177
+
178
+ Examples of background images:
179
+
180
+ | <img src="images/background_image_01.jpg" width="240"> | <img src="images/background_image_02.jpg" width="240"> | <img src="images/background_image_03.jpg" width="240"> | <img src="images/background_image_04.jpg" width="240"> |
181
+ |--------------------------------------------------------|--------------------------------------------------------|--------------------------------------------------------|--------------------------------------------------------|
182
+
183
+ ### Background prompt
184
+
185
+ Instead of a background image you can use text prompt to describe the background. Short and clear prompts work best.
186
+ Additionally, [Compel weighting syntax](https://github.com/damian0815/compel/blob/main/doc/syntax.md) is supported to
187
+ increase or decrease weight of certain tokens. Examples:
188
+ - _in an autumn park_
189
+ - _in front of a brick wall_
190
+ - _on an ocean beach with (palm trees)++_
191
+ - _in a shopping mall_
192
+ - _in a modern office_
193
+
194
+ ### Additional notes
195
+
196
+ We use the "same-crop" approach for clothing and avatar images: images will be cropped roughly the same way (using pose
197
+ estimation), so we don't have to add too much new information (e.g. assume lower body clothing). So, if you use only a
198
+ photo of an upper body clothing the result will also be cropped the same way regardless of the avatar image (and the
199
+ other way around):
200
+
201
+ | Clothing Image | Avatar Image | Result Image |
202
+ |------------------------------------------------------|-----------------------------------------------------|--------------------------------------------------------|
203
+ | <img src="images/clothing_image_02.jpg" width="240"> | <img src="images/avatar_image_02.jpg" width="240"> | <img src="images/same_crop_result_01.jpg" width="240"> |
204
+ | <img src="images/clothing_image_03.jpg" width="240"> | <img src="images/avatar_image_03.jpg" width="240"> | <img src="images/same_crop_result_02.jpg" width="240"> |
205
+
206
+ ## Try-On Output
207
+
208
+ ### Response codes
209
+
210
+ HTTP status code is used as a high-level response status. In case of a successful API call HTTP code 200 will be
211
+ returned and response body will contain a resulting JPEG image with the maximum size of 768x1024 pixels. Response
212
+ will also have the "X-Seed" header set that should contain the actual seed used for image generation (for
213
+ reproducibility). Other status codes (not 200) indicate unsuccessful request, see the table below for additional
214
+ details:
215
+
216
+ | Response Code | Content-Type | Headers | Description | Example |
217
+ |:-------------:|:------------------:|:--------------:|-----------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------:|
218
+ | **200** | image/jpeg | X-Seed: {seed} | Successful API call. Response body contains the resulting image in JPEG format. | <img src="images/same_crop_result_01.jpg" width="160"> |
219
+ | **400** | application/json | | Bad request: at least one of request parameters is invalid. Response body should contain additional error details in JSON format. | { "detail": "Invalid upload file type: application/x-zip-compressed" } |
220
+ | **403** | application/json | | Indicates authentication issue (e.g. invalid API key). | |
221
+ | **422** | application/json | | Request validation error. Response body should contain error details in JSON format. | { "detail": [ { "loc": [ "string", 0], "msg": "string", "type": "string" } ] } |
222
+ | **429** | | | Too many requests. Might be triggered by the RapidAPI proxy in case of reaching maximum request rate or API call limit. | |
223
+ | **500** | | | Indicates an internal server error, might not have any details. | |
224
+
225
+ ### NSFW content
226
+
227
+ We use NSFW content checker to ensure we don't output inappropriate images. If potential NSFW content is detected in the
228
+ generated image, the API will return HTTP status code 400 with a corresponding error message in JSON response.
229
+
230
+ ## Use Cases and Recipes
231
+
232
+ Our Virtual Try-On API offers a flexible way to specify clothing, avatar and background, which makes it possible to not
233
+ only perform a classic task of virtual try-on, but also generate entirely new images or alter existing images in some
234
+ interesting aspects. Feel free to try and explore!
235
+
236
+ In all the examples below all unmentioned inputs are assumed to be empty.
237
+
238
+ ### Image-based virtual try-on
239
+
240
+ The most common use case is to transfer clothing from one photo (e.g. from a product page) to another photo (e.g.
241
+ user avatar) while maintaining the avatar and the background.
242
+
243
+ | Clothing Image | Avatar Image | Result Image |
244
+ |------------------------------------------------------|----------------------------------------------------|----------------------------------------------------------|
245
+ | <img src="images/clothing_image_01.jpg" width="240"> | <img src="images/avatar_image_02.jpg" width="240"> | <img src="images/image_based_result_01.jpg" width="240"> |
246
+
247
+ ### Image-based virtual try-on with background
248
+
249
+ Additionally, it's possible to replace the avatar background with a reference image or a text prompt.
250
+
251
+ | Clothing Image | Avatar Image | Background Image | Result Image |
252
+ |------------------------------------------------------|----------------------------------------------------|--------------------------------------------------------|---------------------------------------------------------------------|
253
+ | <img src="images/clothing_image_04.jpg" width="240"> | <img src="images/avatar_image_03.jpg" width="240"> | <img src="images/background_image_01.jpg" width="240"> | <img src="images/image_based_background_result_01.jpg" width="240"> |
254
+
255
+ And with a text prompt for the background:
256
+
257
+ | Clothing Image | Avatar Image | Background Prompt | Result Image |
258
+ |------------------------------------------------------|----------------------------------------------------|------------------------------|---------------------------------------------------------------------|
259
+ | <img src="images/clothing_image_04.jpg" width="240"> | <img src="images/avatar_image_03.jpg" width="240"> | in front of a snowy mountain | <img src="images/image_based_background_result_02.jpg" width="240"> |
260
+
261
+ ### Avatar from a text prompt
262
+
263
+ It's possible to replace the person on the clothing image with an avatar, described in a text prompt. Background will be
264
+ changed as well and will be a random one if not specified:
265
+
266
+ | Clothing Image | Avatar Prompt | Background Prompt | Result Image |
267
+ |------------------------------------------------------|--------------------------------------------|--------------------|------------------------------------------------------------|
268
+ | <img src="images/clothing_image_02.jpg" width="240"> | a beautiful blond girl with long hair | | <img src="images/avatar_prompt_result_01.jpg" width="240"> |
269
+ | <img src="images/clothing_image_03.jpg" width="240"> | a gentleman with a long beard and mustache | near a fireplace | <img src="images/avatar_prompt_result_02.jpg" width="240"> |
270
+
271
+ You may also experiment with avatar prompts for more interesting results:
272
+
273
+ | Clothing Image | Avatar Prompt | Background Prompt | Result Image |
274
+ |------------------------------------------------------|---------------------|-----------------------|------------------------------------------------------------|
275
+ | <img src="images/clothing_image_03.jpg" width="240"> | (iron man mask)+++ | in the Sahara Desert | <img src="images/avatar_prompt_result_03.jpg" width="240"> |
276
+
277
+ ### Clothing from a text prompt
278
+
279
+ Similarly, you can specify clothing with a text prompt while providing an avatar image:
280
+
281
+ | Clothing Prompt | Avatar Image | Result Image |
282
+ |-------------------------------------|----------------------------------------------------|--------------------------------------------------------------|
283
+ | a sheer blue sleeveless mini dress | <img src="images/avatar_image_02.jpg" width="240"> | <img src="images/clothing_prompt_result_01.jpg" width="240"> |
284
+ | a colorful t-shirt and black shorts | <img src="images/avatar_image_03.jpg" width="240"> | <img src="images/clothing_prompt_result_02.jpg" width="240"> |
285
+
286
+ ### Modifying avatar's body
287
+
288
+ If you specify clothing and avatar images to be the same while providing an avatar prompt it's possible to change
289
+ avatar's body proportions. Note that it may require using additional term weighting to achieve stronger changes.
290
+
291
+ | Clothing Image | Avatar Image | Avatar Prompt | Result Image |
292
+ |------------------------------------------------------|------------------------------------------------------|-------------------------------|------------------------------------------------------------------|
293
+ | <img src="images/clothing_image_01.jpg" width="240"> | <img src="images/clothing_image_01.jpg" width="240"> | a (plus size)+ woman | <img src="images/avatar_modification_result_01.jpg" width="240"> |
294
+ | <img src="images/clothing_image_03.jpg" width="240"> | <img src="images/clothing_image_03.jpg" width="240"> | a (muscular bodybuilder)+++++ | <img src="images/avatar_modification_result_02.jpg" width="240"> |
295
+
296
+ ### Txt2Img
297
+
298
+ As our diffusion model was fine-tuned to produce people wearing various clothing, it can better follow a clothing prompt
299
+ and output realistic people and garments:
300
+
301
+ | Clothing Prompt | Avatar Prompt | Background Prompt | Result Image |
302
+ |-------------------------------------------------|--------------------------------|------------------------|------------------------------------------------------|
303
+ | a paisley pattern purple shirt and beige chinos | a fit man with dark beard | plain white background | <img src="images/txt2img_result_01.jpg" width="240"> |
304
+ | a white polka dot pattern dress | a beautiful petite blond woman | on a yacht | <img src="images/txt2img_result_02.jpg" width="240"> |
305
+
306
+ ### Other creative possibilities
307
+
308
+ If you specify the same image for clothing and avatar while providing a background prompt (or background image) you can
309
+ replace the background in a creative way:
310
+
311
+ | Clothing Image | Avatar Image | Background Prompt | Result Image |
312
+ |----------------------------------------------------|----------------------------------------------------|-------------------------|-------------------------------------------------------------|
313
+ | <img src="images/avatar_image_02.jpg" width="240"> | <img src="images/avatar_image_02.jpg" width="240"> | on a snowy mountain top | <img src="images/new_background_result_01.jpg" width="240"> |
314
+
315
+ It's also possible to use a combination of clothing image, clothing prompt, avatar image and a background to add some
316
+ accessories:
317
+
318
+ | Clothing Image | Clothing Prompt | Avatar Image | Background Image | Result Image |
319
+ |------------------------------------------------------|--------------------------|------------------------------------------------------|--------------------------------------------------------|------------------------------------------------------------------|
320
+ | <img src="images/avatar_image_02.jpg" width="240"> | a (light brown purse)+++ | <img src="images/avatar_image_02.jpg" width="240"> | <img src="images/background_image_03.jpg" width="240"> | <img src="images/accessory_result_01.jpg" width="240"> |
321
+
322
+ ## Performance
323
+
324
+ Typically, one try-on request is processed in 5-10 seconds (depending on type of conditions) excluding network latency.
325
+ In order to reduce network overhead you might want to compress your images before feeding to the API (e.g. using JPEG).
326
+ Please note that in case of a high demand processing time might increase due to request being queued, though we
327
+ constantly monitor our GPU cluster capacity and perform scaling as needed.
328
+
329
+ ## Known Issues and Limitations
330
+
331
+ As any generative model, our models are not perfect (though we constantly work on improvements):
332
+ - Currently, we do not fully support flat lay clothing images. Some might work, but that's not guaranteed.
333
+ - Prompt following might not be perfect, especially in case of long and sophisticated prompts. Prefer simpler and more
334
+ straightforward prompts whenever possible. Also be pretty verbose (e.g. use the word "plain" if you need something of
335
+ solid color). Additionally, Compel weighting might be used to increase weight of certain tokens.
336
+ - As usual, generative models struggle with hands, fingers and toes, though we try to mitigate it to a certain extent.
337
+ - Currently, we do not support trying on a single garment, only the full look.
338
+ - Hats and sunglasses are not currently transferred, but we are working on it.
339
+ - Backgrounds might lack some clarity as currently we focus more on clothing.
340
+ - In case of a specified background a hairstyle might change.
341
+ - Body shape of the avatar might change towards smaller sizes.
docs/images/accessory_result_01.jpg ADDED

Git LFS Details

  • SHA256: 4b1660d9df9205715cf017df5a6f520f0bb170ba20e34ac37f87eaeb6ad3f74b
  • Pointer size: 131 Bytes
  • Size of remote file: 193 kB
docs/images/avatar_image_01.jpg ADDED

Git LFS Details

  • SHA256: 1291a821607d3630318961f184987c8a494bfcc70ac93a315d5aeb8842475b50
  • Pointer size: 131 Bytes
  • Size of remote file: 425 kB
docs/images/avatar_image_02.jpg ADDED

Git LFS Details

  • SHA256: a8f92656f1243d3d9562f91807fa8d3ca11bf66ad9dd3736630f88862d76110b
  • Pointer size: 131 Bytes
  • Size of remote file: 262 kB
docs/images/avatar_image_03.jpg ADDED

Git LFS Details

  • SHA256: d9226c7ff9b67969cfa413c77c4c07974806009d59a96a15c4fbecdee1a5c8e2
  • Pointer size: 131 Bytes
  • Size of remote file: 191 kB
docs/images/avatar_image_04.jpg ADDED

Git LFS Details

  • SHA256: 02831ba12b974525a94e439c353fd720a7dae14c102b4b11baf38c56822807f9
  • Pointer size: 131 Bytes
  • Size of remote file: 352 kB
docs/images/avatar_modification_result_01.jpg ADDED

Git LFS Details

  • SHA256: 5c4d2adebeb2a27599b6a0ea532b8b25b5703697878c2bd4994466729c3e6f6b
  • Pointer size: 131 Bytes
  • Size of remote file: 191 kB
docs/images/avatar_modification_result_02.jpg ADDED

Git LFS Details

  • SHA256: 7447675d79262d0120d6054c96e6723222c2d74451a4ba83a4b28e78fc900c76
  • Pointer size: 131 Bytes
  • Size of remote file: 144 kB
docs/images/avatar_prompt_result_01.jpg ADDED

Git LFS Details

  • SHA256: 06df6a8f830cff7c71459712c8c8bb4edb394580a818bd681644760f96c92dd9
  • Pointer size: 131 Bytes
  • Size of remote file: 260 kB
docs/images/avatar_prompt_result_02.jpg ADDED

Git LFS Details

  • SHA256: b20354374b2366729696d55ede627dc5fbb0cab22d374d4f4200b7283eb60417
  • Pointer size: 131 Bytes
  • Size of remote file: 160 kB
docs/images/avatar_prompt_result_03.jpg ADDED

Git LFS Details

  • SHA256: a40abc74cd27451b6b439a91b8c26e3e2318cd5202b2f0113faecc36a2c44f49
  • Pointer size: 131 Bytes
  • Size of remote file: 116 kB
docs/images/background_image_01.jpg ADDED

Git LFS Details

  • SHA256: cc6ad7187561a6a29044accc996aa242c48ea92f707d245dfdd75d545affd0bf
  • Pointer size: 131 Bytes
  • Size of remote file: 492 kB
docs/images/background_image_02.jpg ADDED

Git LFS Details

  • SHA256: 7a92ab3827aecf1c683f2a5c3f44ae546ede0769e74bbae238ca0380a50fcc6b
  • Pointer size: 131 Bytes
  • Size of remote file: 700 kB
docs/images/background_image_03.jpg ADDED

Git LFS Details

  • SHA256: 661a22b8d8442ad42d6dfa3e0ff563ed421ee7afab07d9bcf4ff5359f41c9d5f
  • Pointer size: 131 Bytes
  • Size of remote file: 511 kB
docs/images/background_image_04.jpg ADDED

Git LFS Details

  • SHA256: e865e32c08a6f98fb92e9da07d646f927f08aa577b8fa30283ec7624474d5286
  • Pointer size: 131 Bytes
  • Size of remote file: 357 kB
docs/images/clothing_image_01.jpg ADDED

Git LFS Details

  • SHA256: 185a51562b6b04b8bc52eaf56c21451325af4379f6cfde4a7dcca8a15f1575c3
  • Pointer size: 131 Bytes
  • Size of remote file: 398 kB
docs/images/clothing_image_02.jpg ADDED

Git LFS Details

  • SHA256: 533de7bd0e3ae1862304523e2035d8ba0015109e8a39368a017a9a757144bafa
  • Pointer size: 131 Bytes
  • Size of remote file: 434 kB
docs/images/clothing_image_03.jpg ADDED

Git LFS Details

  • SHA256: 9495af8b97285a3456bfbb684881cd8c1ba9bfd76e215843d24caeb22c64c9f8
  • Pointer size: 131 Bytes
  • Size of remote file: 313 kB
docs/images/clothing_image_04.jpg ADDED

Git LFS Details

  • SHA256: dfee3b092114533daf468a03707da516433acfc2076ced135e604ba4a7904512
  • Pointer size: 131 Bytes
  • Size of remote file: 407 kB
docs/images/clothing_prompt_result_01.jpg ADDED

Git LFS Details

  • SHA256: 3143f5aedd059a43325c6e5f99a408f04966beea840f64c2170839de97ada65c
  • Pointer size: 131 Bytes
  • Size of remote file: 120 kB
docs/images/clothing_prompt_result_02.jpg ADDED

Git LFS Details

  • SHA256: 5c5400a8899eccfd85a8550f1240aae2a6a3b838894e1afa72535a18cf9100a5
  • Pointer size: 131 Bytes
  • Size of remote file: 178 kB
docs/images/image_based_background_result_01.jpg ADDED

Git LFS Details

  • SHA256: 359ba35386a578aea598df4044020e5ce5f1b5ce323f98e024c906d23d1a671b
  • Pointer size: 131 Bytes
  • Size of remote file: 216 kB
docs/images/image_based_background_result_02.jpg ADDED

Git LFS Details

  • SHA256: 7fb59f6770466a27bccc396cd7040b5bce90cd8c9b3d8daf7466ab95c53272a4
  • Pointer size: 131 Bytes
  • Size of remote file: 282 kB
docs/images/image_based_result_01.jpg ADDED

Git LFS Details

  • SHA256: b907d7e15cbd2a6bc822acd3bb580421cacf6f057c28c4d891d5db9f3365b4fb
  • Pointer size: 131 Bytes
  • Size of remote file: 148 kB
docs/images/new_background_result_01.jpg ADDED

Git LFS Details

  • SHA256: 643f043d2c9fd5553851021d55aef549d610cba36ac2169ae1173d55278b22b5
  • Pointer size: 131 Bytes
  • Size of remote file: 240 kB
docs/images/same_crop_result_01.jpg ADDED

Git LFS Details

  • SHA256: 014b109c9fd456dd2389031283ba5ce7ddf7a674f0eca47ade4c9044de907f84
  • Pointer size: 131 Bytes
  • Size of remote file: 190 kB
docs/images/same_crop_result_02.jpg ADDED

Git LFS Details

  • SHA256: 5e48023a99d70ecc69975e5618a3789b6503d40d856a5767e3a2d564acad224c
  • Pointer size: 131 Bytes
  • Size of remote file: 159 kB
docs/images/txt2img_result_01.jpg ADDED

Git LFS Details

  • SHA256: 68fddf34ccabc2ce5580af2d3bb1415ab20971711d64d4cd078a74c5513e9cec
  • Pointer size: 131 Bytes
  • Size of remote file: 186 kB
docs/images/txt2img_result_02.jpg ADDED

Git LFS Details

  • SHA256: a818bab8929bca1c23d16b0bd9c440d9a2247bff4c69e839f9594d838d1fc9a1
  • Pointer size: 131 Bytes
  • Size of remote file: 171 kB
examples/avatar/female_01.jpg ADDED

Git LFS Details

  • SHA256: feb60696275f5276bcc0dc65e14bd972440b7973baa41609d0b6334d8b1c9880
  • Pointer size: 131 Bytes
  • Size of remote file: 211 kB
examples/avatar/female_02.jpg ADDED

Git LFS Details

  • SHA256: 0b02efe2043a9af0fa79bdc892b2e8535cc9fe83e3887e6ae49f14bff2f6faa0
  • Pointer size: 131 Bytes
  • Size of remote file: 294 kB
examples/avatar/female_03.jpg ADDED

Git LFS Details

  • SHA256: 70653888c42588a919f5eec01f7ce861cb19dd906f97f0c446d266d4c791b51b
  • Pointer size: 131 Bytes
  • Size of remote file: 195 kB
examples/avatar/female_04.jpg ADDED

Git LFS Details

  • SHA256: 4711e7d8e08cda7b29f331c1a790c729bbe264587c59dd76b6370c9e6491845c
  • Pointer size: 131 Bytes
  • Size of remote file: 416 kB
examples/avatar/female_05.jpg ADDED

Git LFS Details

  • SHA256: 1291a821607d3630318961f184987c8a494bfcc70ac93a315d5aeb8842475b50
  • Pointer size: 131 Bytes
  • Size of remote file: 425 kB
examples/avatar/female_06.jpg ADDED

Git LFS Details

  • SHA256: a8f92656f1243d3d9562f91807fa8d3ca11bf66ad9dd3736630f88862d76110b
  • Pointer size: 131 Bytes
  • Size of remote file: 262 kB
examples/avatar/male_01.jpg ADDED

Git LFS Details

  • SHA256: d9226c7ff9b67969cfa413c77c4c07974806009d59a96a15c4fbecdee1a5c8e2
  • Pointer size: 131 Bytes
  • Size of remote file: 191 kB
examples/avatar/male_02.jpg ADDED

Git LFS Details

  • SHA256: 02831ba12b974525a94e439c353fd720a7dae14c102b4b11baf38c56822807f9
  • Pointer size: 131 Bytes
  • Size of remote file: 352 kB
examples/avatar/male_03.jpg ADDED

Git LFS Details

  • SHA256: 2d9441acd683a497d4108582abb99bc333643de3368c05fffb9e911c7d3d1106
  • Pointer size: 131 Bytes
  • Size of remote file: 123 kB
examples/avatar/male_04.jpg ADDED

Git LFS Details

  • SHA256: 99ecc2bf9d21bdd22d1c42bfeab8537ee3dd1ce7139c3d15c6be9e782040a0fb
  • Pointer size: 131 Bytes
  • Size of remote file: 361 kB
examples/avatar/male_05.jpg ADDED

Git LFS Details

  • SHA256: bf364572f22b23c3567dc8f169e329a20f3e3def7cf1bc2e4349d98f16351d87
  • Pointer size: 131 Bytes
  • Size of remote file: 170 kB
examples/avatar/male_06.jpg ADDED

Git LFS Details

  • SHA256: bba21beb25ff292a6917e9cd377ccd53a63b46c97a4bb1e87d8c324a0187a52a
  • Pointer size: 131 Bytes
  • Size of remote file: 308 kB
examples/background/01.jpg ADDED

Git LFS Details

  • SHA256: cc6ad7187561a6a29044accc996aa242c48ea92f707d245dfdd75d545affd0bf
  • Pointer size: 131 Bytes
  • Size of remote file: 492 kB
examples/background/02.jpg ADDED

Git LFS Details

  • SHA256: 7a92ab3827aecf1c683f2a5c3f44ae546ede0769e74bbae238ca0380a50fcc6b
  • Pointer size: 131 Bytes
  • Size of remote file: 700 kB
examples/background/03.jpg ADDED

Git LFS Details

  • SHA256: 0f7f1044891103c2e5697c3b7cbd36ca869c63982f11a266077601b51549b74c
  • Pointer size: 131 Bytes
  • Size of remote file: 336 kB
examples/background/04.jpg ADDED

Git LFS Details

  • SHA256: 661a22b8d8442ad42d6dfa3e0ff563ed421ee7afab07d9bcf4ff5359f41c9d5f
  • Pointer size: 131 Bytes
  • Size of remote file: 511 kB