jonathanrstern commited on
Commit
a262592
1 Parent(s): 62415c5

add handler.py

Browse files
Files changed (1) hide show
  1. handler.py +20 -0
handler.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Dict, List, Any
2
+ from diffusers import DiffusionPipeline
3
+
4
+ class EndpointHandler():
5
+ def __init__(self, path=""):
6
+ # Preload all the elements you are going to need at inference.
7
+ self.pipeline = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0")
8
+ self.pipeline.load_lora_weights("artificialguybr/LogoRedmond-LogoLoraForSDXL")
9
+
10
+ def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
11
+ """
12
+ data args:
13
+ inputs (:obj: `str` | `PIL.Image` | `np.array`)
14
+ kwargs
15
+ Return:
16
+ A :obj:`list` | `dict`: will be serialized and returned
17
+ """
18
+ # Use self.pipeline for inference
19
+ # result = self.pipeline(your_input_data)
20
+ # return result