mikitona commited on
Commit
fcb4ba0
·
verified ·
1 Parent(s): 4cde051

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -12,7 +12,6 @@ from transformers import (
12
  )
13
  from diffusers import DDPMScheduler, AutoencoderKL
14
  from typing import List
15
-
16
  import torch
17
  import os
18
  from transformers import AutoTokenizer
@@ -142,7 +141,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 + 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))
@@ -258,8 +257,8 @@ def start_tryon(
258
  # 画像を追加
259
  output_images.value.append(new_image)
260
 
261
- # ギャラリーを更新
262
- yield output_images.value, None
263
 
264
  # 最終的な結果を返す
265
  return output_images.value, None
@@ -347,4 +346,4 @@ with image_blocks as demo:
347
  api_name='tryon',
348
  )
349
 
350
- image_blocks.launch(show_error=True)
 
12
  )
13
  from diffusers import DDPMScheduler, AutoencoderKL
14
  from typing import List
 
15
  import torch
16
  import os
17
  from transformers import AutoTokenizer
 
141
  left = (width - target_width) / 2
142
  top = (height - target_height) / 2
143
  right = (width + target_width) / 2
144
+ bottom = (height + target_width) / 2
145
  cropped_img = human_img_orig.crop((left, top, right, bottom))
146
  crop_size = cropped_img.size
147
  human_img = cropped_img.resize((768, 1024))
 
257
  # 画像を追加
258
  output_images.value.append(new_image)
259
 
260
+ # ギャラリーを更新しつつmasked_imgを保持
261
+ yield output_images.value, gr.update()
262
 
263
  # 最終的な結果を返す
264
  return output_images.value, None
 
346
  api_name='tryon',
347
  )
348
 
349
+ image_blocks.launch(show_error=True)