Update app.py
Browse files
app.py
CHANGED
@@ -122,7 +122,7 @@ pipe = TryonPipeline.from_pretrained(
|
|
122 |
pipe.unet_encoder = UNet_Encoder
|
123 |
|
124 |
|
125 |
-
@spaces.GPU(duration=
|
126 |
def start_tryon(
|
127 |
dict, garm_img, garment_des, is_checked, is_checked_crop, denoise_steps, seed, num_images
|
128 |
):
|
@@ -142,7 +142,7 @@ def start_tryon(
|
|
142 |
left = (width - target_width) / 2
|
143 |
top = (height - target_height) / 2
|
144 |
right = (width + target_width) / 2
|
145 |
-
bottom = (height +
|
146 |
cropped_img = human_img_orig.crop((left, top, right, bottom))
|
147 |
crop_size = cropped_img.size
|
148 |
human_img = cropped_img.resize((768, 1024))
|
@@ -248,9 +248,9 @@ def start_tryon(
|
|
248 |
out_img = images[0].resize(crop_size)
|
249 |
human_img_copy = human_img_orig.copy()
|
250 |
human_img_copy.paste(out_img, (int(left), int(top)))
|
251 |
-
yield human_img_copy, None
|
252 |
else:
|
253 |
-
yield images[0], None
|
254 |
|
255 |
|
256 |
garm_list = os.listdir(os.path.join(example_path, "cloth"))
|
@@ -305,7 +305,7 @@ with image_blocks as demo:
|
|
305 |
label="Masked image output", elem_id="masked-img", show_share_button=False
|
306 |
)
|
307 |
with gr.Column():
|
308 |
-
|
309 |
|
310 |
with gr.Column():
|
311 |
try_button = gr.Button(value="Try-on")
|
@@ -331,7 +331,7 @@ with image_blocks as demo:
|
|
331 |
seed,
|
332 |
num_images,
|
333 |
],
|
334 |
-
outputs=[
|
335 |
api_name='tryon',
|
336 |
)
|
337 |
|
|
|
122 |
pipe.unet_encoder = UNet_Encoder
|
123 |
|
124 |
|
125 |
+
@spaces.GPU(duration=90) # 実行時間を90秒に設定
|
126 |
def start_tryon(
|
127 |
dict, garm_img, garment_des, is_checked, is_checked_crop, denoise_steps, seed, num_images
|
128 |
):
|
|
|
142 |
left = (width - target_width) / 2
|
143 |
top = (height - target_height) / 2
|
144 |
right = (width + target_width) / 2
|
145 |
+
bottom = (height + target_height) / 2
|
146 |
cropped_img = human_img_orig.crop((left, top, right, bottom))
|
147 |
crop_size = cropped_img.size
|
148 |
human_img = cropped_img.resize((768, 1024))
|
|
|
248 |
out_img = images[0].resize(crop_size)
|
249 |
human_img_copy = human_img_orig.copy()
|
250 |
human_img_copy.paste(out_img, (int(left), int(top)))
|
251 |
+
yield [human_img_copy], None
|
252 |
else:
|
253 |
+
yield [images[0]], None
|
254 |
|
255 |
|
256 |
garm_list = os.listdir(os.path.join(example_path, "cloth"))
|
|
|
305 |
label="Masked image output", elem_id="masked-img", show_share_button=False
|
306 |
)
|
307 |
with gr.Column():
|
308 |
+
image_gallery = gr.Gallery(label="Generated Images", elem_id="output-gallery", show_label=True)
|
309 |
|
310 |
with gr.Column():
|
311 |
try_button = gr.Button(value="Try-on")
|
|
|
331 |
seed,
|
332 |
num_images,
|
333 |
],
|
334 |
+
outputs=[image_gallery, masked_img],
|
335 |
api_name='tryon',
|
336 |
)
|
337 |
|