Quoc Bao Bui
commited on
Commit
·
e5e883d
1
Parent(s):
059fad7
Add GPU mode
Browse files- handler.py +1 -4
handler.py
CHANGED
|
@@ -7,9 +7,6 @@ from PIL import Image
|
|
| 7 |
from diffusers import StableDiffusionPipeline
|
| 8 |
|
| 9 |
|
| 10 |
-
REPO_ID = "runwayml/stable-diffusion-v1-5"
|
| 11 |
-
|
| 12 |
-
|
| 13 |
# helper decoder
|
| 14 |
def decode_base64_image(image_string):
|
| 15 |
base64_image = base64.b64decode(image_string)
|
|
@@ -20,7 +17,7 @@ def decode_base64_image(image_string):
|
|
| 20 |
class EndpointHandler:
|
| 21 |
def __init__(self, path=""):
|
| 22 |
self.pipe = StableDiffusionPipeline.from_pretrained("./stable-diffusion-v1-5")
|
| 23 |
-
|
| 24 |
|
| 25 |
def __call__(self, data: Any) -> List[List[Dict[str, float]]]:
|
| 26 |
"""
|
|
|
|
| 7 |
from diffusers import StableDiffusionPipeline
|
| 8 |
|
| 9 |
|
|
|
|
|
|
|
|
|
|
| 10 |
# helper decoder
|
| 11 |
def decode_base64_image(image_string):
|
| 12 |
base64_image = base64.b64decode(image_string)
|
|
|
|
| 17 |
class EndpointHandler:
|
| 18 |
def __init__(self, path=""):
|
| 19 |
self.pipe = StableDiffusionPipeline.from_pretrained("./stable-diffusion-v1-5")
|
| 20 |
+
self.pipe = self.pipe.to("cuda")
|
| 21 |
|
| 22 |
def __call__(self, data: Any) -> List[List[Dict[str, float]]]:
|
| 23 |
"""
|