sakhan2 commited on
Commit
e5949be
·
1 Parent(s): a40e6d3

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +4 -4
handler.py CHANGED
@@ -37,9 +37,9 @@ class EndpointHandler():
37
  if not prompt or not isinstance(prompt, str) or not base64_image or not isinstance(base64_image, str):
38
  return {"error": "Invalid input. Please provide a prompt and a base64 encoded image."}
39
 
40
- num_inference_steps = data.get("num_inference_steps", 30)
41
- guidance_scale = data.get("guidance_scale", 7.5)
42
- negative_prompt = data.get("negative_prompt")
43
  num_images_per_prompt = data.get("num_images_per_prompt", 1)
44
  controlnet_conditioning_scale = data.get("controlnet_conditioning_scale", 0.5)
45
 
@@ -86,7 +86,7 @@ class EndpointHandler():
86
 
87
  def get_canny_image(self, base_image: Image) -> Image:
88
  image = np.array(base_image)
89
- image = cv2.Canny(image, 100, 200)
90
  image = np.stack([image] * 3, axis=2)
91
  return Image.fromarray(image)
92
 
 
37
  if not prompt or not isinstance(prompt, str) or not base64_image or not isinstance(base64_image, str):
38
  return {"error": "Invalid input. Please provide a prompt and a base64 encoded image."}
39
 
40
+ num_inference_steps = data.get("num_inference_steps", 50)
41
+ guidance_scale = data.get("guidance_scale", 8)
42
+ negative_prompt = "ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, extra limbs, disfigured, deformed, body out of frame, bad anatomy, watermark, signature, cut off, low contrast, underexposed, overexposed, bad art, beginner, amateur, distorted face, low quality, photorealistic"
43
  num_images_per_prompt = data.get("num_images_per_prompt", 1)
44
  controlnet_conditioning_scale = data.get("controlnet_conditioning_scale", 0.5)
45
 
 
86
 
87
  def get_canny_image(self, base_image: Image) -> Image:
88
  image = np.array(base_image)
89
+ image = cv2.Canny(image, 125, 150)
90
  image = np.stack([image] * 3, axis=2)
91
  return Image.fromarray(image)
92