Update handler.py
Browse files- handler.py +16 -0
handler.py
CHANGED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import Dict, List, Any
|
2 |
+
|
3 |
+
class EndpointHandler():
|
4 |
+
def __init__(self, path=""):
|
5 |
+
# Preload all the elements you are going to need at inference.
|
6 |
+
# pseudo:
|
7 |
+
# self.model= load_model(path)
|
8 |
+
|
9 |
+
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
10 |
+
"""
|
11 |
+
data args:
|
12 |
+
inputs (:obj: `str` | `PIL.Image` | `np.array`)
|
13 |
+
kwargs
|
14 |
+
Return:
|
15 |
+
A :obj:`list` | `dict`: will be serialized and returned
|
16 |
+
"""
|