mindspore_serving

MindSpore Serving.

mindspore_serving.master

mindspore_serving.worker

mindspore_serving.worker.register

mindspore_serving.client

MindSpore Serving Client

class mindspore_serving.client.Client(ip, port, servable_name, method_name, version_number=0)[source]

The Client encapsulates the serving gRPC API, which can be used to create requests, access serving, and parse results.

Parameters
  • ip (str) – Serving ip.

  • port (int) – Serving port.

  • servable_name (str) – The name of servable supplied by Serving.

  • method_name (str) – The name of method supplied by servable.

  • version_number (int) – The version number of servable, default 0, which means the maximum version number in all running versions.

Raises

RuntimeError – The type or value of the parameters is invalid, or other errors happened.

Examples

>>> from mindspore_serving.client import Client
>>> import numpy as np
>>> client = Client("localhost", 5500, "add", "add_cast")
>>> instances = []
>>> x1 = np.ones((2, 2), np.int32)
>>> x2 = np.ones((2, 2), np.int32)
>>> instances.append({"x1": x1, "x2": x2})
>>> result = client.infer(instances)
>>> print(result)
infer(instances)[source]

Used to create requests, access serving, and parse results.

Parameters

instances (map, tuple of map) – Instance or tuple of instances, every instance item is the inputs map. The map key is the input name, and the value is the input value.

Raises

RuntimeError – The type or value of the parameters is invalid, or other errors happened.