add custom handler
Browse files- __pycache__/handler.cpython-38.pyc +0 -0
- handler.py +5 -0
__pycache__/handler.cpython-38.pyc
CHANGED
Binary files a/__pycache__/handler.cpython-38.pyc and b/__pycache__/handler.cpython-38.pyc differ
|
|
handler.py
CHANGED
@@ -20,6 +20,11 @@ class EndpointHandler():
|
|
20 |
|
21 |
self.MAX_PROMPT_LENGTH = 77
|
22 |
self.diffusion_model = DiffusionModel(self.img_height, self.img_width, self.MAX_PROMPT_LENGTH)
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
def _get_initial_diffusion_noise(self, batch_size, seed):
|
25 |
if seed is not None:
|
|
|
20 |
|
21 |
self.MAX_PROMPT_LENGTH = 77
|
22 |
self.diffusion_model = DiffusionModel(self.img_height, self.img_width, self.MAX_PROMPT_LENGTH)
|
23 |
+
diffusion_model_weights_fpath = keras.utils.get_file(
|
24 |
+
origin="https://huggingface.co/fchollet/stable-diffusion/resolve/main/kcv_diffusion_model.h5",
|
25 |
+
file_hash="8799ff9763de13d7f30a683d653018e114ed24a6a819667da4f5ee10f9e805fe",
|
26 |
+
)
|
27 |
+
self.diffusion_model.load_weights(diffusion_model_weights_fpath)
|
28 |
|
29 |
def _get_initial_diffusion_noise(self, batch_size, seed):
|
30 |
if seed is not None:
|