chaerinmin commited on
Commit
a95d78d
·
1 Parent(s): ac33442

hf cuda issue

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -473,7 +473,10 @@ def visualize_ref(ref, ex_mask):
473
  inpaint_mask, opts.image_size, interpolation=cv2.INTER_AREA
474
  )
475
  inpaint_mask = (inpaint_mask > 128).astype(np.uint8)
476
- img = cv2.cvtColor(ref["background"], cv2.COLOR_RGBA2RGB)
 
 
 
477
  else:
478
  inpaint_mask = np.array(ref["layers"][0])[..., -1]
479
  inpaint_mask = cv2.resize(
@@ -485,6 +488,8 @@ def visualize_ref(ref, ex_mask):
485
 
486
  # viualization
487
  mask = inpainted < 128
 
 
488
  img = mask_image(img, mask)
489
  if inpaint_mask.sum() == 0:
490
  gr.Warning("Run botton not enabled? Please try again.", duration=10)
 
473
  inpaint_mask, opts.image_size, interpolation=cv2.INTER_AREA
474
  )
475
  inpaint_mask = (inpaint_mask > 128).astype(np.uint8)
476
+ try:
477
+ img = cv2.cvtColor(ref["background"], cv2.COLOR_RGBA2RGB)
478
+ except:
479
+ gr.Warning("Internal Error. Please do Clear and try again.", duration=10)
480
  else:
481
  inpaint_mask = np.array(ref["layers"][0])[..., -1]
482
  inpaint_mask = cv2.resize(
 
488
 
489
  # viualization
490
  mask = inpainted < 128
491
+ if img.shape[0] != mask.shape[0]:
492
+ gr.Warning("Internal Error. Please do Clear and try again.", duration=10)
493
  img = mask_image(img, mask)
494
  if inpaint_mask.sum() == 0:
495
  gr.Warning("Run botton not enabled? Please try again.", duration=10)