Mirza Učanbarlić
commited on
Commit
·
0e2a33a
1
Parent(s):
c2c212c
add path
Browse files- handler.py +6 -1
handler.py
CHANGED
|
@@ -3,12 +3,17 @@ from diffusers import StableDiffusionImg2ImgPipeline
|
|
| 3 |
from diffusers.utils import load_image
|
| 4 |
import base64
|
| 5 |
from io import BytesIO
|
|
|
|
|
|
|
| 6 |
|
| 7 |
class EndpointHandler():
|
| 8 |
def __init__(self, path=""):
|
| 9 |
repo_id = "runwayml/stable-diffusion-v1-5"
|
| 10 |
self.pipeline = StableDiffusionImg2ImgPipeline.from_pretrained(repo_id)
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
| 14 |
"""
|
|
|
|
| 3 |
from diffusers.utils import load_image
|
| 4 |
import base64
|
| 5 |
from io import BytesIO
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
import os
|
| 8 |
|
| 9 |
class EndpointHandler():
|
| 10 |
def __init__(self, path=""):
|
| 11 |
repo_id = "runwayml/stable-diffusion-v1-5"
|
| 12 |
self.pipeline = StableDiffusionImg2ImgPipeline.from_pretrained(repo_id)
|
| 13 |
+
# Get path of the LoRA weights
|
| 14 |
+
lora_path = Path("./pixel-portrait-v1.safetensors")
|
| 15 |
+
|
| 16 |
+
self.pipeline.load_lora_weights(lora_path)
|
| 17 |
|
| 18 |
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
| 19 |
"""
|