lixiang46 commited on
Commit
2398aef
1 Parent(s): aae94cd

check empty image

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -10,6 +10,8 @@ import json
10
 
11
 
12
  def start_tryon(person_img, garment_img, seed, randomize_seed):
 
 
13
  if randomize_seed:
14
  seed = random.randint(0, MAX_SEED)
15
  encoded_person_img = cv2.imencode('.jpg', cv2.cvtColor(person_img, cv2.COLOR_RGB2BGR))[1].tobytes()
@@ -146,7 +148,6 @@ with gr.Blocks(css=css) as Tryon:
146
  label=None
147
  )
148
 
149
- image1.clear()
150
 
151
  image1.change(
152
  fn = change_imgs,
 
10
 
11
 
12
  def start_tryon(person_img, garment_img, seed, randomize_seed):
13
+ if person_img == None or garment_img == None:
14
+ return None, None, None, "Empty image"
15
  if randomize_seed:
16
  seed = random.randint(0, MAX_SEED)
17
  encoded_person_img = cv2.imencode('.jpg', cv2.cvtColor(person_img, cv2.COLOR_RGB2BGR))[1].tobytes()
 
148
  label=None
149
  )
150
 
 
151
 
152
  image1.change(
153
  fn = change_imgs,