Update handler.py
Browse files- handler.py +3 -2
handler.py
CHANGED
|
@@ -57,7 +57,7 @@ CONTROLNET_MAPPING = {
|
|
| 57 |
class EndpointHandler():
|
| 58 |
def __init__(self, path=""):
|
| 59 |
# define default controlnet id and load controlnet
|
| 60 |
-
self.control_type = "
|
| 61 |
self.controlnet = ControlNetModel.from_pretrained(CONTROLNET_MAPPING[self.control_type]["model_id"],torch_dtype=dtype).to(device)
|
| 62 |
|
| 63 |
# Load StableDiffusionControlNetPipeline
|
|
@@ -92,6 +92,7 @@ class EndpointHandler():
|
|
| 92 |
|
| 93 |
|
| 94 |
# hyperparamters
|
|
|
|
| 95 |
num_inference_steps = data.pop("num_inference_steps", 30)
|
| 96 |
guidance_scale = data.pop("guidance_scale", 7.5)
|
| 97 |
negative_prompt = data.pop("negative_prompt", None)
|
|
@@ -126,4 +127,4 @@ class EndpointHandler():
|
|
| 126 |
base64_image = base64.b64decode(image_string)
|
| 127 |
buffer = BytesIO(base64_image)
|
| 128 |
image = Image.open(buffer)
|
| 129 |
-
return image
|
|
|
|
| 57 |
class EndpointHandler():
|
| 58 |
def __init__(self, path=""):
|
| 59 |
# define default controlnet id and load controlnet
|
| 60 |
+
self.control_type = "depth"
|
| 61 |
self.controlnet = ControlNetModel.from_pretrained(CONTROLNET_MAPPING[self.control_type]["model_id"],torch_dtype=dtype).to(device)
|
| 62 |
|
| 63 |
# Load StableDiffusionControlNetPipeline
|
|
|
|
| 92 |
|
| 93 |
|
| 94 |
# hyperparamters
|
| 95 |
+
negatice_prompt = data.pop("negative_prompt", None)
|
| 96 |
num_inference_steps = data.pop("num_inference_steps", 30)
|
| 97 |
guidance_scale = data.pop("guidance_scale", 7.5)
|
| 98 |
negative_prompt = data.pop("negative_prompt", None)
|
|
|
|
| 127 |
base64_image = base64.b64decode(image_string)
|
| 128 |
buffer = BytesIO(base64_image)
|
| 129 |
image = Image.open(buffer)
|
| 130 |
+
return image
|