fvonhoven commited on
Commit
6eff921
1 Parent(s): 5f5b290

Revert to fork code

Browse files
Files changed (1) hide show
  1. handler.py +3 -7
handler.py CHANGED
@@ -76,15 +76,11 @@ class EndpointHandler():
76
  """
77
  prompt = data.pop("inputs", None)
78
  image = data.pop("image", None)
79
- count = data.pop("count", None)
80
  controlnet_type = data.pop("controlnet_type", None)
81
 
82
  # Check if neither prompt nor image is provided
83
  if prompt is None and image is None:
84
  return {"error": "Please provide a prompt and base64 encoded image."}
85
-
86
- if count is None:
87
- return {"error": "Please provide a count."}
88
 
89
  # Check if a new controlnet is provided
90
  if controlnet_type is not None and controlnet_type != self.control_type:
@@ -114,7 +110,7 @@ class EndpointHandler():
114
  image=control_image,
115
  num_inference_steps=num_inference_steps,
116
  guidance_scale=guidance_scale,
117
- num_images_per_prompt=count,
118
  height=height,
119
  width=width,
120
  controlnet_conditioning_scale=controlnet_conditioning_scale,
@@ -123,11 +119,11 @@ class EndpointHandler():
123
 
124
 
125
  # return first generate PIL image
126
- return out.images[0, count]
127
 
128
  # helper to decode input image
129
  def decode_base64_image(self, image_string):
130
  base64_image = base64.b64decode(image_string)
131
  buffer = BytesIO(base64_image)
132
  image = Image.open(buffer)
133
- return image
 
76
  """
77
  prompt = data.pop("inputs", None)
78
  image = data.pop("image", None)
 
79
  controlnet_type = data.pop("controlnet_type", None)
80
 
81
  # Check if neither prompt nor image is provided
82
  if prompt is None and image is None:
83
  return {"error": "Please provide a prompt and base64 encoded image."}
 
 
 
84
 
85
  # Check if a new controlnet is provided
86
  if controlnet_type is not None and controlnet_type != self.control_type:
 
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,
 
119
 
120
 
121
  # return first generate PIL image
122
+ return out.images[0]
123
 
124
  # helper to decode input image
125
  def decode_base64_image(self, image_string):
126
  base64_image = base64.b64decode(image_string)
127
  buffer = BytesIO(base64_image)
128
  image = Image.open(buffer)
129
+ return image