Try-on--test
#8
by tarek79789 - opened
- app.py +11 -4
- assets/title.html +1 -4
app.py
CHANGED
|
@@ -190,7 +190,7 @@ def upload_image(image, upload_type, did, ip, user_id, user_name):
|
|
| 190 |
upload_url = upload_image_url
|
| 191 |
else:
|
| 192 |
upload_url = upload_background_image_url
|
| 193 |
-
image_format = "PNG"
|
| 194 |
mime_type = f"image/{image_format.lower()}"
|
| 195 |
timestamp = str(int(time.time()))
|
| 196 |
signature = generate_signature(
|
|
@@ -395,7 +395,6 @@ with gr.Blocks(css=css) as WeShop:
|
|
| 395 |
gr.Markdown("#### Step 1: Upload a garment image")
|
| 396 |
main_image_input = gr.Image(
|
| 397 |
type="pil",
|
| 398 |
-
format='png',
|
| 399 |
label="Main Image",
|
| 400 |
elem_classes=["image-container", "hide-buttons"]
|
| 401 |
)
|
|
@@ -411,7 +410,6 @@ with gr.Blocks(css=css) as WeShop:
|
|
| 411 |
gr.Markdown("#### Step 2: Upload a person image")
|
| 412 |
background_image_input = gr.Image(
|
| 413 |
type="pil",
|
| 414 |
-
format='png',
|
| 415 |
label="Background reference image",
|
| 416 |
elem_classes=["image-container", "hide-buttons"]
|
| 417 |
)
|
|
@@ -428,7 +426,6 @@ with gr.Blocks(css=css) as WeShop:
|
|
| 428 |
gr.Markdown("#### Step 3: Press 'Generate' to get the result")
|
| 429 |
output = gr.Image(
|
| 430 |
type="pil",
|
| 431 |
-
format='png',
|
| 432 |
label="Result",
|
| 433 |
elem_classes=["image-container", "hide-buttons"],
|
| 434 |
interactive=False
|
|
@@ -456,4 +453,14 @@ with gr.Blocks(css=css) as WeShop:
|
|
| 456 |
inputs=[main_image_input, background_image_input, output],
|
| 457 |
elem_id="example-res-images",
|
| 458 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 459 |
WeShop.queue(api_open=False).launch(show_api=False)
|
|
|
|
| 190 |
upload_url = upload_image_url
|
| 191 |
else:
|
| 192 |
upload_url = upload_background_image_url
|
| 193 |
+
image_format = image.format if image.format else "PNG"
|
| 194 |
mime_type = f"image/{image_format.lower()}"
|
| 195 |
timestamp = str(int(time.time()))
|
| 196 |
signature = generate_signature(
|
|
|
|
| 395 |
gr.Markdown("#### Step 1: Upload a garment image")
|
| 396 |
main_image_input = gr.Image(
|
| 397 |
type="pil",
|
|
|
|
| 398 |
label="Main Image",
|
| 399 |
elem_classes=["image-container", "hide-buttons"]
|
| 400 |
)
|
|
|
|
| 410 |
gr.Markdown("#### Step 2: Upload a person image")
|
| 411 |
background_image_input = gr.Image(
|
| 412 |
type="pil",
|
|
|
|
| 413 |
label="Background reference image",
|
| 414 |
elem_classes=["image-container", "hide-buttons"]
|
| 415 |
)
|
|
|
|
| 426 |
gr.Markdown("#### Step 3: Press 'Generate' to get the result")
|
| 427 |
output = gr.Image(
|
| 428 |
type="pil",
|
|
|
|
| 429 |
label="Result",
|
| 430 |
elem_classes=["image-container", "hide-buttons"],
|
| 431 |
interactive=False
|
|
|
|
| 453 |
inputs=[main_image_input, background_image_input, output],
|
| 454 |
elem_id="example-res-images",
|
| 455 |
)
|
| 456 |
+
main_image_input.upload(
|
| 457 |
+
fn=preprocess_image,
|
| 458 |
+
inputs=[main_image_input],
|
| 459 |
+
outputs=main_image_input
|
| 460 |
+
)
|
| 461 |
+
background_image_input.upload(
|
| 462 |
+
fn=preprocess_background_image,
|
| 463 |
+
inputs=[background_image_input],
|
| 464 |
+
outputs=background_image_input
|
| 465 |
+
)
|
| 466 |
WeShop.queue(api_open=False).launch(show_api=False)
|
assets/title.html
CHANGED
|
@@ -85,9 +85,7 @@
|
|
| 85 |
<br>
|
| 86 |
<div class="content-text">
|
| 87 |
<strong>How It Works: </strong>Digitally dress any model in any garment. Upload a clear image of the
|
| 88 |
-
clothing and a photo of your model, and our AI will seamlessly outfit them.
|
| 89 |
-
href="https://www.weshop.ai/tools/virtualtryon" style="font-weight: bold;" target="_blank">WeShopAI
|
| 90 |
-
Virtual Try-On</a>.
|
| 91 |
</div>
|
| 92 |
<br>
|
| 93 |
<div class="content-text">
|
|
@@ -101,7 +99,6 @@
|
|
| 101 |
<span class="nav-links">
|
| 102 |
<a href="https://huggingface.co/spaces/WeShopAI/WeShopAI-Fashion-Model-Pose-Change">WeShopAI Fashion Model Pose Change</a>
|
| 103 |
<a href="https://huggingface.co/spaces/WeShopAI/WeShopAI-Bad-Hand-Fixer">WeShopAI Bad Hand Fixer</a>
|
| 104 |
-
<a href="https://huggingface.co/spaces/WeShopAI/WeShopAI-Swap-Face-And-BG">WeShopAI Swap Face & BG</a>
|
| 105 |
</span>
|
| 106 |
</div>
|
| 107 |
<br>
|
|
|
|
| 85 |
<br>
|
| 86 |
<div class="content-text">
|
| 87 |
<strong>How It Works: </strong>Digitally dress any model in any garment. Upload a clear image of the
|
| 88 |
+
clothing and a photo of your model, and our AI will seamlessly outfit them.
|
|
|
|
|
|
|
| 89 |
</div>
|
| 90 |
<br>
|
| 91 |
<div class="content-text">
|
|
|
|
| 99 |
<span class="nav-links">
|
| 100 |
<a href="https://huggingface.co/spaces/WeShopAI/WeShopAI-Fashion-Model-Pose-Change">WeShopAI Fashion Model Pose Change</a>
|
| 101 |
<a href="https://huggingface.co/spaces/WeShopAI/WeShopAI-Bad-Hand-Fixer">WeShopAI Bad Hand Fixer</a>
|
|
|
|
| 102 |
</span>
|
| 103 |
</div>
|
| 104 |
<br>
|