jonathanpark
commited on
Commit
•
f3b3a2f
1
Parent(s):
3424746
break it
Browse files- handler.py +1 -2
handler.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
from typing import Dict, List, Any
|
2 |
import torch
|
3 |
-
import requests
|
4 |
from PIL import Image
|
5 |
from io import BytesIO
|
6 |
from diffusers import StableDiffusionPipeline, StableDiffusionImg2ImgPipeline, DDIMScheduler
|
@@ -15,7 +14,6 @@ model_id = "stabilityai/stable-diffusion-2-1-base"
|
|
15 |
|
16 |
class EndpointHandler():
|
17 |
def __init__(self, path=""):
|
18 |
-
raise NotImplementedError();
|
19 |
# load the optimized model
|
20 |
self.textPipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
21 |
self.textPipe.scheduler = DDIMScheduler.from_config(self.textPipe.scheduler.config)
|
@@ -27,6 +25,7 @@ class EndpointHandler():
|
|
27 |
self.imgPipe = self.imgPipe.to(device)
|
28 |
|
29 |
def __call__(self, data: Any) -> List[List[Dict[str, float]]]:
|
|
|
30 |
"""
|
31 |
Args:
|
32 |
data (:obj:):
|
|
|
1 |
from typing import Dict, List, Any
|
2 |
import torch
|
|
|
3 |
from PIL import Image
|
4 |
from io import BytesIO
|
5 |
from diffusers import StableDiffusionPipeline, StableDiffusionImg2ImgPipeline, DDIMScheduler
|
|
|
14 |
|
15 |
class EndpointHandler():
|
16 |
def __init__(self, path=""):
|
|
|
17 |
# load the optimized model
|
18 |
self.textPipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
19 |
self.textPipe.scheduler = DDIMScheduler.from_config(self.textPipe.scheduler.config)
|
|
|
25 |
self.imgPipe = self.imgPipe.to(device)
|
26 |
|
27 |
def __call__(self, data: Any) -> List[List[Dict[str, float]]]:
|
28 |
+
raise NotImplementedError()
|
29 |
"""
|
30 |
Args:
|
31 |
data (:obj:):
|