Upload handler.py
Browse files- handler.py +5 -1
handler.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import supervision as sv
|
2 |
import urllib.request
|
3 |
import numpy as np
|
@@ -12,7 +13,10 @@ class EndpointHandler():
|
|
12 |
api_key=key
|
13 |
)
|
14 |
|
15 |
-
def __call__(self,
|
|
|
|
|
|
|
16 |
########################### Load Image #################################
|
17 |
if(isurl): # for url set isurl = 1
|
18 |
req = urllib.request.urlopen(path)
|
|
|
1 |
+
from typing import Dict, List, Any
|
2 |
import supervision as sv
|
3 |
import urllib.request
|
4 |
import numpy as np
|
|
|
13 |
api_key=key
|
14 |
)
|
15 |
|
16 |
+
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
17 |
+
inputs = data.get("inputs")
|
18 |
+
isurl = inputs.get("isurl")
|
19 |
+
path = inputs.get("path")
|
20 |
########################### Load Image #################################
|
21 |
if(isurl): # for url set isurl = 1
|
22 |
req = urllib.request.urlopen(path)
|