karimbenharrak commited on
Commit
3997115
1 Parent(s): 2412efa

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +7 -5
handler.py CHANGED
@@ -53,6 +53,13 @@ class EndpointHandler():
53
 
54
  prompt = data.pop("prompt", "")
55
 
 
 
 
 
 
 
 
56
  negative_prompt = data.pop("negative_prompt", "")
57
 
58
  method = data.pop("method", "slow")
@@ -82,11 +89,6 @@ class EndpointHandler():
82
 
83
  return image
84
 
85
- if(method == "smooth"):
86
- image = self.smooth_pipe(prompt, image=image).images
87
-
88
- return image
89
-
90
  #pipe = AutoPipelineForInpainting.from_pretrained("diffusers/stable-diffusion-xl-1.0-inpainting-0.1", torch_dtype=torch.float16, variant="fp16").to("cuda")
91
 
92
  self.pipe.enable_xformers_memory_efficient_attention()
 
53
 
54
  prompt = data.pop("prompt", "")
55
 
56
+ if(method == "smooth"):
57
+ if encoded_image is not None:
58
+ image = self.decode_base64_image(encoded_image)
59
+ out = self.smooth_pipe(prompt, image=image).images[0]
60
+
61
+ return out
62
+
63
  negative_prompt = data.pop("negative_prompt", "")
64
 
65
  method = data.pop("method", "slow")
 
89
 
90
  return image
91
 
 
 
 
 
 
92
  #pipe = AutoPipelineForInpainting.from_pretrained("diffusers/stable-diffusion-xl-1.0-inpainting-0.1", torch_dtype=torch.float16, variant="fp16").to("cuda")
93
 
94
  self.pipe.enable_xformers_memory_efficient_attention()