karimbenharrak commited on
Commit
01f7239
1 Parent(s): 0687973

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +6 -5
handler.py CHANGED
@@ -19,10 +19,10 @@ class EndpointHandler():
19
  #self.generator = torch.Generator(device="cuda").manual_seed(0)
20
 
21
 
22
- self.smooth_pipe = StableDiffusionXLImg2ImgPipeline.from_pretrained(
23
- "stabilityai/stable-diffusion-xl-refiner-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True
24
- )
25
- self.smooth_pipe.to("cuda")
26
 
27
 
28
  # load StableDiffusionInpaintPipeline pipeline
@@ -59,13 +59,14 @@ class EndpointHandler():
59
  strength = data.pop("strength", 0.2)
60
  guidance_scale = data.pop("guidance_scale", 8.0)
61
  num_inference_steps = data.pop("num_inference_steps", 20)
62
-
63
  if(method == "smooth"):
64
  if encoded_image is not None:
65
  image = self.decode_base64_image(encoded_image)
66
  out = self.smooth_pipe(prompt, image=image).images[0]
67
 
68
  return out
 
69
 
70
  # process image
71
  if encoded_image is not None and encoded_mask_image is not None:
 
19
  #self.generator = torch.Generator(device="cuda").manual_seed(0)
20
 
21
 
22
+ # self.smooth_pipe = StableDiffusionXLImg2ImgPipeline.from_pretrained(
23
+ # "stabilityai/stable-diffusion-xl-refiner-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True
24
+ # )
25
+ # self.smooth_pipe.to("cuda")
26
 
27
 
28
  # load StableDiffusionInpaintPipeline pipeline
 
59
  strength = data.pop("strength", 0.2)
60
  guidance_scale = data.pop("guidance_scale", 8.0)
61
  num_inference_steps = data.pop("num_inference_steps", 20)
62
+ """
63
  if(method == "smooth"):
64
  if encoded_image is not None:
65
  image = self.decode_base64_image(encoded_image)
66
  out = self.smooth_pipe(prompt, image=image).images[0]
67
 
68
  return out
69
+ """
70
 
71
  # process image
72
  if encoded_image is not None and encoded_mask_image is not None: