karimbenharrak commited on
Commit
d4f30b7
1 Parent(s): ad69bb7

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +4 -7
handler.py CHANGED
@@ -32,7 +32,7 @@ class EndpointHandler():
32
 
33
 
34
  self.pipe = StableDiffusionControlNetInpaintPipeline.from_pretrained(
35
- "diffusers/stable-diffusion-xl-1.0-inpainting-0.1", controlnet=self.controlnet, torch_dtype=torch.float16
36
  )
37
 
38
  self.pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(self.pipe.scheduler.config)
@@ -156,24 +156,21 @@ class EndpointHandler():
156
  # return first generate PIL image
157
  return image
158
  """
159
-
160
- control_image = self.make_inpaint_condition(image, mask_image)
161
 
 
162
 
163
  # generate image
164
  image = self.pipe(
165
  prompt=prompt,
166
- image=image,
167
  negative_prompt=negative_prompt,
168
  num_inference_steps=num_inference_steps,
169
  eta=1.0,
 
170
  mask_image=mask_image,
171
  control_image=control_image,
172
  guidance_scale=guidance_scale,
173
- strength=strength,
174
  ).images[0]
175
-
176
- return image
177
 
178
 
179
  # helper to decode input image
 
32
 
33
 
34
  self.pipe = StableDiffusionControlNetInpaintPipeline.from_pretrained(
35
+ "runwayml/stable-diffusion-v1-5", controlnet=self.controlnet, torch_dtype=torch.float16
36
  )
37
 
38
  self.pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(self.pipe.scheduler.config)
 
156
  # return first generate PIL image
157
  return image
158
  """
 
 
159
 
160
+ control_image = self.make_inpaint_condition(image, mask_image)
161
 
162
  # generate image
163
  image = self.pipe(
164
  prompt=prompt,
 
165
  negative_prompt=negative_prompt,
166
  num_inference_steps=num_inference_steps,
167
  eta=1.0,
168
+ image=image,
169
  mask_image=mask_image,
170
  control_image=control_image,
171
  guidance_scale=guidance_scale,
172
+ strength=strength
173
  ).images[0]
 
 
174
 
175
 
176
  # helper to decode input image