zkwang commited on
Commit
373f290
1 Parent(s): 830c1e5

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +4 -3
handler.py CHANGED
@@ -22,10 +22,11 @@ class EndpointHandler():
22
 
23
  # pass inputs with all kwargs in data
24
  if parameters is not None:
25
- embeddings = self.model.encode(inputs, **parameters)
26
  else:
27
- embeddings = self.model.encode(inputs)
28
  # postprocess the prediction
29
- return embeddings
 
30
 
31
  # return self.model.encode(inputs, batch_size=12, max_length=8192)['dense_vecs']
 
22
 
23
  # pass inputs with all kwargs in data
24
  if parameters is not None:
25
+ embeddings = self.model.encode(inputs, **parameters)['dense_vecs']
26
  else:
27
+ embeddings = self.model.encode(inputs)['dense_vecs']
28
  # postprocess the prediction
29
+ list_of_lists = [arr.tolist() for arr in embeddings]
30
+ return json.dumps(list_of_lists)
31
 
32
  # return self.model.encode(inputs, batch_size=12, max_length=8192)['dense_vecs']