hermanhelf
commited on
Commit
·
27ec10e
1
Parent(s):
54bc972
handler stub
Browse files- handler.py +20 -0
handler.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python3
|
2 |
+
from typing import Dict, List, Any
|
3 |
+
|
4 |
+
class EndpointHandler():
|
5 |
+
def __init__(self, path=""):
|
6 |
+
# Preload all the elements you are going to need at inference.
|
7 |
+
# pseudo:
|
8 |
+
# self.model= load_model(path)
|
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 |
+
|
19 |
+
# pseudo
|
20 |
+
# self.model(input)
|