sergeipetrov commited on
Commit
cb25f79
1 Parent(s): 757691d

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +4 -2
handler.py CHANGED
@@ -8,7 +8,7 @@ import torch
8
 
9
  class EndpointHandler():
10
  def __init__(self, path=""):
11
- self.pipeline = AutoPipelineForInpainting.from_pretrained("diffusers/stable-diffusion-xl-1.0-inpainting-0.1", torch_dtype=torch.float16, variant="fp16").to("cuda")
12
 
13
  def __call__(self, data: Dict[str, Any]):
14
  """
@@ -25,7 +25,9 @@ class EndpointHandler():
25
  image = Image.open(BytesIO(base64.b64decode(inputs['image'])))
26
  mask = Image.open(BytesIO(base64.b64decode(inputs['mask'])))
27
  prompt = inputs['prompt']
28
-
 
 
29
  # fix the seed
30
  generator = torch.Generator(device="cuda").manual_seed(0)
31
 
 
8
 
9
  class EndpointHandler():
10
  def __init__(self, path=""):
11
+ self.pipeline = AutoPipelineForInpainting.from_pretrained("OzzyGT/RealVisXL_V4.0_inpainting", torch_dtype=torch.float16, variant="fp16").to("cuda")
12
 
13
  def __call__(self, data: Dict[str, Any]):
14
  """
 
25
  image = Image.open(BytesIO(base64.b64decode(inputs['image'])))
26
  mask = Image.open(BytesIO(base64.b64decode(inputs['mask'])))
27
  prompt = inputs['prompt']
28
+ # blur mask for smooth transition
29
+ mask = pipeline.mask_processor.blur(mask, blur_factor=20)
30
+
31
  # fix the seed
32
  generator = torch.Generator(device="cuda").manual_seed(0)
33