Ben Nguyen commited on
Commit
e423171
1 Parent(s): 1320603
Files changed (1) hide show
  1. handler.py +3 -4
handler.py CHANGED
@@ -1,11 +1,10 @@
1
  from typing import Dict, List, Any
2
- from comet import load_from_checkpoint as lfc
3
- import os
4
 
5
 
6
  class EndpointHandler():
7
  def __init__(self, path=""):
8
- self.m = lfc("model.ckpt")
9
 
10
  def __call__(self, data: Dict[str, Any]) -> List[Any]:
11
  """
@@ -22,7 +21,7 @@ class EndpointHandler():
22
 
23
  data = inputs.pop("data")
24
 
25
- model_output = self.m.predict(data, batch_size=batch_size, num_workers=workers, gpus=0)
26
  scores = model_output["scores"]
27
 
28
  return scores
 
1
  from typing import Dict, List, Any
2
+ from comet import load_from_checkpoint
 
3
 
4
 
5
  class EndpointHandler():
6
  def __init__(self, path=""):
7
+ self.model = load_from_checkpoint("model.ckpt")
8
 
9
  def __call__(self, data: Dict[str, Any]) -> List[Any]:
10
  """
 
21
 
22
  data = inputs.pop("data")
23
 
24
+ model_output = self.model.predict(data, batch_size=batch_size, num_workers=workers, gpus=0)
25
  scores = model_output["scores"]
26
 
27
  return scores