jayyap commited on
Commit
7f2f07a
·
1 Parent(s): 0f32a58

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +16 -13
handler.py CHANGED
@@ -103,19 +103,22 @@ class EndpointHandler():
103
  image = self.decode_base64_image(image)
104
  control_image = CONTROLNET_MAPPING[self.control_type]["hinter"](image)
105
 
106
- # run inference pipeline
107
- out = self.pipe(
108
- prompt=prompt,
109
- negative_prompt=negative_prompt,
110
- image=control_image,
111
- num_inference_steps=num_inference_steps,
112
- guidance_scale=guidance_scale,
113
- num_images_per_prompt=1,
114
- height=height,
115
- width=width,
116
- controlnet_conditioning_scale=controlnet_conditioning_scale,
117
- generator=self.generator
118
- )
 
 
 
119
 
120
 
121
  # return first generate PIL image
 
103
  image = self.decode_base64_image(image)
104
  control_image = CONTROLNET_MAPPING[self.control_type]["hinter"](image)
105
 
106
+ image = image.resize((512, 512))
107
+
108
+ with torch.no_grad():
109
+ # run inference pipeline
110
+ out = self.pipe(
111
+ prompt=prompt,
112
+ negative_prompt=negative_prompt,
113
+ image=control_image,
114
+ num_inference_steps=num_inference_steps,
115
+ guidance_scale=guidance_scale,
116
+ num_images_per_prompt=1,
117
+ height=height,
118
+ width=width,
119
+ controlnet_conditioning_scale=controlnet_conditioning_scale,
120
+ generator=self.generator
121
+ )
122
 
123
 
124
  # return first generate PIL image