Spaces:
Running
on
Zero
Running
on
Zero
dryade36513
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -175,8 +175,8 @@ def start_tryon(dict,garm_img,garment_des,is_checked,is_checked_crop,denoise_ste
|
|
175 |
# Extract the images
|
176 |
with torch.cuda.amp.autocast():
|
177 |
with torch.no_grad():
|
178 |
-
prompt = "model is wearing " + garment_des
|
179 |
-
negative_prompt = "monochrome, lowres, bad anatomy, worst quality, low quality"
|
180 |
with torch.inference_mode():
|
181 |
(
|
182 |
prompt_embeds,
|
@@ -190,8 +190,8 @@ def start_tryon(dict,garm_img,garment_des,is_checked,is_checked_crop,denoise_ste
|
|
190 |
negative_prompt=negative_prompt,
|
191 |
)
|
192 |
|
193 |
-
prompt = "a photo of " + garment_des
|
194 |
-
negative_prompt = "monochrome, lowres, bad anatomy, worst quality, low quality"
|
195 |
if not isinstance(prompt, List):
|
196 |
prompt = [prompt] * 1
|
197 |
if not isinstance(negative_prompt, List):
|
@@ -264,26 +264,26 @@ with image_blocks as demo:
|
|
264 |
gr.Markdown("使用您的影像和服裝影像進行虛擬試穿")
|
265 |
with gr.Row():
|
266 |
with gr.Column():
|
267 |
-
imgs = gr.ImageEditor(sources='upload', type="pil", label='
|
268 |
with gr.Row():
|
269 |
-
is_checked = gr.Checkbox(label="Yes", info="
|
270 |
with gr.Row():
|
271 |
-
is_checked_crop = gr.Checkbox(label="Yes", info="
|
272 |
|
273 |
example = gr.Examples(
|
274 |
inputs=imgs,
|
275 |
-
examples_per_page=
|
276 |
examples=human_ex_list
|
277 |
)
|
278 |
|
279 |
with gr.Column():
|
280 |
-
garm_img = gr.Image(label="
|
281 |
with gr.Row(elem_id="prompt-container"):
|
282 |
with gr.Row():
|
283 |
-
prompt = gr.Textbox(
|
284 |
example = gr.Examples(
|
285 |
inputs=garm_img,
|
286 |
-
examples_per_page=
|
287 |
examples=garm_list_path)
|
288 |
with gr.Column():
|
289 |
# image_out = gr.Image(label="Output", elem_id="output-img", height=400)
|
@@ -296,11 +296,11 @@ with image_blocks as demo:
|
|
296 |
|
297 |
|
298 |
with gr.Column():
|
299 |
-
try_button = gr.Button(value="
|
300 |
-
with gr.Accordion(label="
|
301 |
with gr.Row():
|
302 |
denoise_steps = gr.Number(label="Denoising Steps", minimum=20, maximum=40, value=30, step=1)
|
303 |
-
seed = gr.Number(label="Seed", minimum=-1, maximum=2147483647, step=1, value
|
304 |
|
305 |
|
306 |
|
|
|
175 |
# Extract the images
|
176 |
with torch.cuda.amp.autocast():
|
177 |
with torch.no_grad():
|
178 |
+
prompt = "((best quality, masterpiece, ultra-detailed, high quality photography, photo realistic)), the model is wearing " + garment_des
|
179 |
+
negative_prompt = "monochrome, lowres, bad anatomy, worst quality, normal quality, low quality, blurry, jpeg artifacts, sketch"
|
180 |
with torch.inference_mode():
|
181 |
(
|
182 |
prompt_embeds,
|
|
|
190 |
negative_prompt=negative_prompt,
|
191 |
)
|
192 |
|
193 |
+
prompt = "((best quality, masterpiece, ultra-detailed, high quality photography, photo realistic)), a photo of " + garment_des
|
194 |
+
negative_prompt = "monochrome, lowres, bad anatomy, worst quality, normal quality, low quality, blurry, jpeg artifacts, sketch"
|
195 |
if not isinstance(prompt, List):
|
196 |
prompt = [prompt] * 1
|
197 |
if not isinstance(negative_prompt, List):
|
|
|
264 |
gr.Markdown("使用您的影像和服裝影像進行虛擬試穿")
|
265 |
with gr.Row():
|
266 |
with gr.Column():
|
267 |
+
imgs = gr.ImageEditor(sources='upload', type="pil", label='AI虛擬模特兒-請啟用全自動偵測模式或是使用畫筆在需要更衣的部位塗抹註記', interactive=True)
|
268 |
with gr.Row():
|
269 |
+
is_checked = gr.Checkbox(label="Yes", info="啟用全自動偵測更衣模式",value=True)
|
270 |
with gr.Row():
|
271 |
+
is_checked_crop = gr.Checkbox(label="Yes", info="開啟自動剪裁並調整圖片大小模式",value=False)
|
272 |
|
273 |
example = gr.Examples(
|
274 |
inputs=imgs,
|
275 |
+
examples_per_page=15,
|
276 |
examples=human_ex_list
|
277 |
)
|
278 |
|
279 |
with gr.Column():
|
280 |
+
garm_img = gr.Image(label="成衣正鋪相片", sources='upload', type="pil")
|
281 |
with gr.Row(elem_id="prompt-container"):
|
282 |
with gr.Row():
|
283 |
+
prompt = gr.Textbox(label="(選填)輸入該衣物的英文描述", placeholder="Short Sleeve Round Neck T-shirts", show_label=True, elem_id="prompt")
|
284 |
example = gr.Examples(
|
285 |
inputs=garm_img,
|
286 |
+
examples_per_page=16,
|
287 |
examples=garm_list_path)
|
288 |
with gr.Column():
|
289 |
# image_out = gr.Image(label="Output", elem_id="output-img", height=400)
|
|
|
296 |
|
297 |
|
298 |
with gr.Column():
|
299 |
+
try_button = gr.Button(value="更衣")
|
300 |
+
with gr.Accordion(label="進階設定", open=False):
|
301 |
with gr.Row():
|
302 |
denoise_steps = gr.Number(label="Denoising Steps", minimum=20, maximum=40, value=30, step=1)
|
303 |
+
seed = gr.Number(label="Seed", minimum=-1, maximum=2147483647, step=1, value=-1)
|
304 |
|
305 |
|
306 |
|