def encode(self, texts):
if self.is_valid_input(texts):
self.socket.send_pyobj(texts)
return self.formatter(self.socket.recv_pyobj())
else:
raise AttributeError(""texts" must be "List[str]"!")
@staticmethod
After Change
self.socket.send_pyobj(texts)
response = self.socket.recv_multipart()
arr_info, arr_val = jsonapi.loads(response[4]), response[7]
X = np.frombuffer(memoryview(arr_val), dtype=arr_info["dtype"])
return self.formatter(X.reshape(arr_info["shape"]))
else:
raise AttributeError(""texts" must be "List[str]"!")