Update handler.py
Browse files- handler.py +3 -0
handler.py
CHANGED
@@ -26,6 +26,9 @@ class EndpointHandler():
|
|
26 |
return self.get_top_k(probs[0], k=k)
|
27 |
|
28 |
def __call__(self, data: Dict[str, Any]) -> Dict[str, Any]:
|
|
|
|
|
|
|
29 |
frame = np.array(data.get("frame"))
|
30 |
|
31 |
if frame is None:
|
|
|
26 |
return self.get_top_k(probs[0], k=k)
|
27 |
|
28 |
def __call__(self, data: Dict[str, Any]) -> Dict[str, Any]:
|
29 |
+
if isinstance(data, str):
|
30 |
+
data = json.loads(data) # Parse JSON string to dictionary
|
31 |
+
|
32 |
frame = np.array(data.get("frame"))
|
33 |
|
34 |
if frame is None:
|