Charbel Malo commited on
Commit
7505f36
1 Parent(s): a41ef40

Update face_parsing/parse_mask.py

Browse files
Files changed (1) hide show
  1. face_parsing/parse_mask.py +4 -1
face_parsing/parse_mask.py CHANGED
@@ -7,9 +7,11 @@ from PIL import Image
7
  from tqdm import tqdm
8
  import torch.nn.functional as F
9
  import torchvision.transforms as transforms
 
10
 
11
  from . model import BiSeNet
12
 
 
13
  class SoftErosion(nn.Module):
14
  def __init__(self, kernel_size=15, threshold=0.6, iterations=1):
15
  super(SoftErosion, self).__init__()
@@ -59,7 +61,8 @@ transform = transforms.Compose([
59
 
60
 
61
 
62
- def init_parsing_model(model_path, device="cpu"):
 
63
  net = BiSeNet(19)
64
  net.to(device)
65
  net.load_state_dict(torch.load(model_path))
 
7
  from tqdm import tqdm
8
  import torch.nn.functional as F
9
  import torchvision.transforms as transforms
10
+ import spaces
11
 
12
  from . model import BiSeNet
13
 
14
+ @spaces.GPU(enable_queue=True)
15
  class SoftErosion(nn.Module):
16
  def __init__(self, kernel_size=15, threshold=0.6, iterations=1):
17
  super(SoftErosion, self).__init__()
 
61
 
62
 
63
 
64
+ @spaces.GPU(enable_queue=True)
65
+ def init_parsing_model(model_path, device="cuda"):
66
  net = BiSeNet(19)
67
  net.to(device)
68
  net.load_state_dict(torch.load(model_path))