Add adapter conditioning scale and factor to handler
Browse files- handler.py +7 -0
handler.py
CHANGED
|
@@ -81,6 +81,9 @@ class EndpointHandler():
|
|
| 81 |
# get inputs
|
| 82 |
inputs = data.pop("inputs", "")
|
| 83 |
encoded_image = data.pop("image", None)
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
# Decode image and convert to black and white sketch
|
| 86 |
decoded_image = self.decode_base64_image(encoded_image).convert('RGB')
|
|
@@ -102,6 +105,8 @@ class EndpointHandler():
|
|
| 102 |
num_inference_steps=num_inference_steps,
|
| 103 |
denoising_end=high_noise_frac,
|
| 104 |
guidance_scale=7.5,
|
|
|
|
|
|
|
| 105 |
output_type="latent",
|
| 106 |
).images
|
| 107 |
|
|
@@ -112,6 +117,8 @@ class EndpointHandler():
|
|
| 112 |
num_inference_steps=num_inference_steps,
|
| 113 |
denoising_start=high_noise_frac,
|
| 114 |
guidance_scale=7.5,
|
|
|
|
|
|
|
| 115 |
).images[0]
|
| 116 |
|
| 117 |
# output_image.save("./output2.png")
|
|
|
|
| 81 |
# get inputs
|
| 82 |
inputs = data.pop("inputs", "")
|
| 83 |
encoded_image = data.pop("image", None)
|
| 84 |
+
adapter_conditioning_scale = data.pop("adapter_conditioning_scale", 1)
|
| 85 |
+
adapter_conditioning_factor = data.pop("adapter_conditioning_factor", 1)
|
| 86 |
+
|
| 87 |
|
| 88 |
# Decode image and convert to black and white sketch
|
| 89 |
decoded_image = self.decode_base64_image(encoded_image).convert('RGB')
|
|
|
|
| 105 |
num_inference_steps=num_inference_steps,
|
| 106 |
denoising_end=high_noise_frac,
|
| 107 |
guidance_scale=7.5,
|
| 108 |
+
adapter_conditioning_scale=adapter_conditioning_scale,
|
| 109 |
+
adapter_conditioning_factor=adapter_conditioning_factor,
|
| 110 |
output_type="latent",
|
| 111 |
).images
|
| 112 |
|
|
|
|
| 117 |
num_inference_steps=num_inference_steps,
|
| 118 |
denoising_start=high_noise_frac,
|
| 119 |
guidance_scale=7.5,
|
| 120 |
+
adapter_conditioning_scale=adapter_conditioning_scale,
|
| 121 |
+
adapter_conditioning_factor=adapter_conditioning_factor,
|
| 122 |
).images[0]
|
| 123 |
|
| 124 |
# output_image.save("./output2.png")
|