karimbenharrak
commited on
Commit
•
c127bd9
1
Parent(s):
17581a5
Update handler.py
Browse files- handler.py +5 -3
handler.py
CHANGED
@@ -25,7 +25,7 @@ class EndpointHandler():
|
|
25 |
# )
|
26 |
# self.smooth_pipe.to("cuda")
|
27 |
|
28 |
-
|
29 |
self.controlnet = ControlNetModel.from_pretrained(
|
30 |
"lllyasviel/control_v11p_sd15_inpaint", torch_dtype=torch.float16
|
31 |
)
|
@@ -38,8 +38,9 @@ class EndpointHandler():
|
|
38 |
self.pipe.scheduler = EulerDiscreteScheduler.from_config(self.pipe.scheduler.config)
|
39 |
self.pipe.enable_model_cpu_offload()
|
40 |
self.pipe.enable_xformers_memory_efficient_attention()
|
41 |
-
|
42 |
"""
|
|
|
|
|
43 |
# load StableDiffusionInpaintPipeline pipeline
|
44 |
self.pipe = AutoPipelineForInpainting.from_pretrained(
|
45 |
"runwayml/stable-diffusion-inpainting",
|
@@ -155,8 +156,8 @@ class EndpointHandler():
|
|
155 |
|
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
|
@@ -173,6 +174,7 @@ class EndpointHandler():
|
|
173 |
).images[0]
|
174 |
|
175 |
return image
|
|
|
176 |
|
177 |
|
178 |
# helper to decode input image
|
|
|
25 |
# )
|
26 |
# self.smooth_pipe.to("cuda")
|
27 |
|
28 |
+
"""
|
29 |
self.controlnet = ControlNetModel.from_pretrained(
|
30 |
"lllyasviel/control_v11p_sd15_inpaint", torch_dtype=torch.float16
|
31 |
)
|
|
|
38 |
self.pipe.scheduler = EulerDiscreteScheduler.from_config(self.pipe.scheduler.config)
|
39 |
self.pipe.enable_model_cpu_offload()
|
40 |
self.pipe.enable_xformers_memory_efficient_attention()
|
|
|
41 |
"""
|
42 |
+
|
43 |
+
|
44 |
# load StableDiffusionInpaintPipeline pipeline
|
45 |
self.pipe = AutoPipelineForInpainting.from_pretrained(
|
46 |
"runwayml/stable-diffusion-inpainting",
|
|
|
156 |
|
157 |
# return first generate PIL image
|
158 |
return image
|
159 |
+
|
160 |
"""
|
|
|
161 |
control_image = self.make_inpaint_condition(image, mask_image)
|
162 |
|
163 |
# generate image
|
|
|
174 |
).images[0]
|
175 |
|
176 |
return image
|
177 |
+
"""
|
178 |
|
179 |
|
180 |
# helper to decode input image
|