Update handler.py
Browse files- handler.py +5 -2
handler.py
CHANGED
|
@@ -7,8 +7,11 @@ class InferenceHandler:
|
|
| 7 |
def __init__(self):
|
| 8 |
self.device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 9 |
model_name = "colt12/maxcushion"
|
| 10 |
-
self.pipe = StableDiffusionXLPipeline.from_pretrained(
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
def __call__(self, inputs):
|
| 14 |
prompt = inputs.get("prompt", "")
|
|
|
|
| 7 |
def __init__(self):
|
| 8 |
self.device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 9 |
model_name = "colt12/maxcushion"
|
| 10 |
+
self.pipe = StableDiffusionXLPipeline.from_pretrained(
|
| 11 |
+
model_name,
|
| 12 |
+
torch_dtype=torch.float16,
|
| 13 |
+
use_safetensors=True
|
| 14 |
+
).to(self.device) # Moved to the device here
|
| 15 |
|
| 16 |
def __call__(self, inputs):
|
| 17 |
prompt = inputs.get("prompt", "")
|