Update handler.py
Browse files- handler.py +6 -2
handler.py
CHANGED
|
@@ -7,11 +7,15 @@ 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 |
model_name,
|
| 12 |
torch_dtype=torch.float16,
|
| 13 |
-
use_safetensors=True
|
| 14 |
-
|
|
|
|
|
|
|
| 15 |
|
| 16 |
def __call__(self, inputs):
|
| 17 |
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 |
+
|
| 11 |
+
# If your model is private, include the use_auth_token parameter
|
| 12 |
self.pipe = StableDiffusionXLPipeline.from_pretrained(
|
| 13 |
model_name,
|
| 14 |
torch_dtype=torch.float16,
|
| 15 |
+
use_safetensors=True,
|
| 16 |
+
# Uncomment the line below and replace with your token if needed
|
| 17 |
+
# use_auth_token="your_huggingface_token"
|
| 18 |
+
).to(self.device)
|
| 19 |
|
| 20 |
def __call__(self, inputs):
|
| 21 |
prompt = inputs.get("prompt", "")
|