Update handler.py
Browse files- handler.py +4 -6
handler.py
CHANGED
@@ -3,12 +3,10 @@ import base64
|
|
3 |
from PIL import Image
|
4 |
from io import BytesIO
|
5 |
from diffusers import StableDiffusionControlNetPipeline, ControlNetModel
|
6 |
-
import torch
|
7 |
-
|
8 |
-
|
9 |
# import Safety Checker
|
10 |
-
|
11 |
-
from
|
|
|
12 |
|
13 |
|
14 |
import numpy as np
|
@@ -73,7 +71,7 @@ class EndpointHandler():
|
|
73 |
torch_dtype=dtype,
|
74 |
#safety_checker=None).to(device)
|
75 |
processor = AutoProcessor.from_pretrained("CompVis/stable-diffusion-safety-checker")
|
76 |
-
|
77 |
|
78 |
# Define Generator with seed
|
79 |
self.generator = torch.Generator(device="cpu").manual_seed(3)
|
|
|
3 |
from PIL import Image
|
4 |
from io import BytesIO
|
5 |
from diffusers import StableDiffusionControlNetPipeline, ControlNetModel
|
|
|
|
|
|
|
6 |
# import Safety Checker
|
7 |
+
# from transformers import AutoProcessor, SafetyChecker
|
8 |
+
from diffusers.pipelines.stable_diffusion import StableDiffusionSafetyChecker
|
9 |
+
import torch
|
10 |
|
11 |
|
12 |
import numpy as np
|
|
|
71 |
torch_dtype=dtype,
|
72 |
#safety_checker=None).to(device)
|
73 |
processor = AutoProcessor.from_pretrained("CompVis/stable-diffusion-safety-checker")
|
74 |
+
safety_checker = SafetyChecker.from_pretrained("CompVis/stable-diffusion-safety-checker")
|
75 |
|
76 |
# Define Generator with seed
|
77 |
self.generator = torch.Generator(device="cpu").manual_seed(3)
|