KawaiiApp commited on
Commit
a632781
1 Parent(s): 9fc68a1

input key added

Browse files
Files changed (1) hide show
  1. handler.py +6 -3
handler.py CHANGED
@@ -31,7 +31,8 @@ class EndpointHandler():
31
  Returns:
32
  Dict[str, str]: Dictionary with the base64 encoded image.
33
  """
34
- positive_prompt = data.pop("positive_prompt", "")
 
35
  negative_prompt = data.pop("negative_prompt", None)
36
  height = data.pop("height", 512)
37
  width = data.pop("width", 512)
@@ -41,10 +42,12 @@ class EndpointHandler():
41
  # Run inference pipeline
42
  with autocast(device.type):
43
  if negative_prompt is None:
44
- image = self.pipe(prompt=positive_prompt, height=height, width=width, guidance_scale=float(guidance_scale))
 
45
  image = image.images[0]
46
  else:
47
- image = self.pipe(prompt=positive_prompt, negative_prompt=negative_prompt, height=height, width=width, guidance_scale=float(guidance_scale))
 
48
  image = image.images[0]
49
 
50
  # Encode image as base64
 
31
  Returns:
32
  Dict[str, str]: Dictionary with the base64 encoded image.
33
  """
34
+ inputs = data.pop("inputs", data)
35
+ # positive_prompt = data.pop("positive_prompt", None)
36
  negative_prompt = data.pop("negative_prompt", None)
37
  height = data.pop("height", 512)
38
  width = data.pop("width", 512)
 
42
  # Run inference pipeline
43
  with autocast(device.type):
44
  if negative_prompt is None:
45
+ print(prompt=inputs, height=height, width=width, guidance_scale=float(guidance_scale))
46
+ image = self.pipe(prompt=inputs, height=height, width=width, guidance_scale=float(guidance_scale))
47
  image = image.images[0]
48
  else:
49
+ print(prompt=inputs, height=height, width=width, guidance_scale=float(guidance_scale))
50
+ image = self.pipe(prompt=inputs, negative_prompt=negative_prompt, height=height, width=width, guidance_scale=float(guidance_scale))
51
  image = image.images[0]
52
 
53
  # Encode image as base64