Update handler.py
Browse files- handler.py +4 -4
handler.py
CHANGED
@@ -3,16 +3,16 @@ from PIL import Image
|
|
3 |
from io import BytesIO
|
4 |
import torch
|
5 |
import base64
|
6 |
-
from diffusers import
|
7 |
|
8 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
9 |
|
10 |
class EndpointHandler():
|
11 |
def __init__(self, path=""):
|
12 |
-
model_id = "
|
13 |
-
self.pipe =
|
14 |
self.pipe.to(device)
|
15 |
-
self.pipe.scheduler =
|
16 |
|
17 |
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
18 |
"""
|
|
|
3 |
from io import BytesIO
|
4 |
import torch
|
5 |
import base64
|
6 |
+
from diffusers import StableDiffusionImg2ImgPipeline
|
7 |
|
8 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
9 |
|
10 |
class EndpointHandler():
|
11 |
def __init__(self, path=""):
|
12 |
+
model_id = "hafsa000/interior-design"
|
13 |
+
self.pipe = StableDiffusionImg2ImgPipeline.from_pretrained(model_id, torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32, safety_checker=None)
|
14 |
self.pipe.to(device)
|
15 |
+
self.pipe.scheduler = PNDMScheduler.from_config(self.pipe.scheduler.config)
|
16 |
|
17 |
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
18 |
"""
|