|
import gradio as gr |
|
from PIL import Image |
|
import time |
|
|
|
def tryon_model(person_img, cloth_img): |
|
|
|
time.sleep(2) |
|
|
|
|
|
person = person_img.convert("RGB").resize((256, 256)) |
|
cloth = cloth_img.convert("RGB").resize((256, 256)) |
|
output = Image.new("RGB", (512, 256)) |
|
output.paste(person, (0, 0)) |
|
output.paste(cloth, (256, 0)) |
|
|
|
return output |
|
|
|
demo = gr.Interface( |
|
fn=tryon_model, |
|
inputs=[ |
|
gr.Image(type="pil", label="Person Image"), |
|
gr.Image(type="pil", label="Cloth Image") |
|
], |
|
outputs=gr.Image(type="pil", label="Output Image"), |
|
title="TryOnGAN Demo", |
|
description="Upload a person image and a cloth image. The output shows a simulated try-on result.", |
|
) |
|
|
|
demo.launch() |
|
|