djl234 commited on
Commit
5cab366
·
verified ·
1 Parent(s): 09d07ec

Update app.py

Browse files

[fix] col out of index

Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -34,7 +34,7 @@ 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()
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
 
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().unsqueeze(2).repeat(1,1,3)
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