Update handler.py
Browse files- handler.py +8 -2
handler.py
CHANGED
|
@@ -6,6 +6,11 @@ from diffusers import StableDiffusionControlNetPipeline, ControlNetModel
|
|
| 6 |
import torch
|
| 7 |
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
import numpy as np
|
| 10 |
import cv2
|
| 11 |
import controlnet_hinter
|
|
@@ -67,8 +72,9 @@ class EndpointHandler():
|
|
| 67 |
controlnet=self.controlnet,
|
| 68 |
torch_dtype=dtype,
|
| 69 |
#safety_checker=None).to(device)
|
| 70 |
-
|
| 71 |
-
|
|
|
|
| 72 |
# Define Generator with seed
|
| 73 |
self.generator = torch.Generator(device="cpu").manual_seed(3)
|
| 74 |
|
|
|
|
| 6 |
import torch
|
| 7 |
|
| 8 |
|
| 9 |
+
# import Safety Checker
|
| 10 |
+
|
| 11 |
+
from transformers import AutoProcessor, SafetyChecker
|
| 12 |
+
|
| 13 |
+
|
| 14 |
import numpy as np
|
| 15 |
import cv2
|
| 16 |
import controlnet_hinter
|
|
|
|
| 72 |
controlnet=self.controlnet,
|
| 73 |
torch_dtype=dtype,
|
| 74 |
#safety_checker=None).to(device)
|
| 75 |
+
processor = AutoProcessor.from_pretrained("CompVis/stable-diffusion-safety-checker")
|
| 76 |
+
safety_checker = SafetyChecker.from_pretrained("CompVis/stable-diffusion-safety-checker")
|
| 77 |
+
|
| 78 |
# Define Generator with seed
|
| 79 |
self.generator = torch.Generator(device="cpu").manual_seed(3)
|
| 80 |
|