handler
Browse files- handler.py +10 -6
handler.py
CHANGED
@@ -13,11 +13,15 @@ class EndpointHandler:
|
|
13 |
Args:
|
14 |
data (:obj:): prediction input text
|
15 |
"""
|
16 |
-
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
|
23 |
-
return {
|
|
|
|
|
|
|
|
|
|
13 |
Args:
|
14 |
data (:obj:): prediction input text
|
15 |
"""
|
16 |
+
inputs = data.pop("inputs", data)
|
17 |
|
18 |
+
start = perf_counter()
|
19 |
+
prediction = self.pipeline(inputs)
|
20 |
+
end = perf_counter()
|
21 |
+
latency = end - start
|
22 |
|
23 |
+
return {
|
24 |
+
"labels": prediction.labels,
|
25 |
+
"scores": prediction.scores,
|
26 |
+
"latency (secs.)": latency
|
27 |
+
}
|