create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from PIL import Image
|
3 |
+
import time
|
4 |
+
|
5 |
+
def tryon_model(person_img, cloth_img):
|
6 |
+
# Simulate processing
|
7 |
+
time.sleep(2)
|
8 |
+
|
9 |
+
# Combine person and cloth images side by side for demo
|
10 |
+
person = person_img.convert("RGB").resize((256, 256))
|
11 |
+
cloth = cloth_img.convert("RGB").resize((256, 256))
|
12 |
+
output = Image.new("RGB", (512, 256))
|
13 |
+
output.paste(person, (0, 0))
|
14 |
+
output.paste(cloth, (256, 0))
|
15 |
+
|
16 |
+
return output
|
17 |
+
|
18 |
+
demo = gr.Interface(
|
19 |
+
fn=tryon_model,
|
20 |
+
inputs=[
|
21 |
+
gr.Image(type="pil", label="Person Image"),
|
22 |
+
gr.Image(type="pil", label="Cloth Image")
|
23 |
+
],
|
24 |
+
outputs=gr.Image(type="pil", label="Output Image"),
|
25 |
+
title="TryOnGAN Demo",
|
26 |
+
description="Upload a person image and a cloth image. The output shows a simulated try-on result.",
|
27 |
+
)
|
28 |
+
|
29 |
+
demo.launch()
|