djl234 commited on
Commit
f698025
·
verified ·
1 Parent(s): da8cd1e

Update app.py

Browse files

[fix]mask_torch not defined

Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -34,7 +34,8 @@ def generate_mask(img, coord):
34
  #
35
  mask = sepia((img*0.999999).astype(np.uint8),(img*0.999999).astype(np.uint8),(img*0.999999).astype(np.uint8),(img*0.999999).astype(np.uint8),(img*0.999999).astype(np.uint8), stack_image=False)
36
  col = torch.from_numpy(mask).squeeze()
37
- mask_torch=torch.from_numpy(mask).squeeze()/mask_torch.max()
 
38
  col[:,:,0]=0
39
  mix = (1-mask_torch)*img+mask_torch*img*0.7+mask_torch*col*0.3
40
  return mix.numpy().astype(np.uint8)#overlay_mask(img, mask)
 
34
  #
35
  mask = sepia((img*0.999999).astype(np.uint8),(img*0.999999).astype(np.uint8),(img*0.999999).astype(np.uint8),(img*0.999999).astype(np.uint8),(img*0.999999).astype(np.uint8), stack_image=False)
36
  col = torch.from_numpy(mask).squeeze()
37
+ mask_torch=torch.from_numpy(mask).squeeze()
38
+ maks_torch=mask_torch/mask_torch.max()
39
  col[:,:,0]=0
40
  mix = (1-mask_torch)*img+mask_torch*img*0.7+mask_torch*col*0.3
41
  return mix.numpy().astype(np.uint8)#overlay_mask(img, mask)