debaleena82001 commited on
Commit
91cc172
·
verified ·
1 Parent(s): b87909b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -45,10 +45,10 @@ def apply_blur_effect(image, blur_type):
45
  predicted_mask = torch.argmax(logits, dim=1).squeeze().cpu().numpy()
46
 
47
  # Create a binary mask (1 = foreground, 0 = background)
48
- foreground_mask = (predicted_mask == 11).astype(np.uint8) # 'Person' class in Cityscapes dataset
49
 
50
  # Convert the mask into a PIL image for processing
51
- mask_image = Image.fromarray((foreground_mask * 255).astype(np.uint8))
52
 
53
  # Apply Gaussian blur to the entire image
54
  blurred_image = image.filter(ImageFilter.GaussianBlur(radius=15))
 
45
  predicted_mask = torch.argmax(logits, dim=1).squeeze().cpu().numpy()
46
 
47
  # Create a binary mask (1 = foreground, 0 = background)
48
+ foreground_mask = (predicted_mask == 11).astype(np.uint8)
49
 
50
  # Convert the mask into a PIL image for processing
51
+ mask_image = Image.fromarray((foreground_mask * 255).astype(np.uint8)).resize(image.size)
52
 
53
  # Apply Gaussian blur to the entire image
54
  blurred_image = image.filter(ImageFilter.GaussianBlur(radius=15))