Inferencing applications can be achieved using any of the methods described below.
Hydrosphere UI
To send a sample request using Hydrosphere UI, open the desired application, and press the Test button at the upper right corner. We will generate dummy inputs based on your model's contract and send an HTTP request to the model's endpoint.
To send an HTTP request, you should send a POST request to the /gateway/application/<applicationName> endpoint with the JSON body containing your request data, composed with respect to the model's contract.
Path Parameters
Name
Type
Description
application:name
string
Name of the application
Request Body
Name
Type
Description
object
Request data, composed with respect to the model's contract.
gRPC
To send a gRPC request you need to create a specific client.
import grpc import hydro_serving_grpc as hs # pip install hydro-serving-grpc# connect to your ML Lamba instancechannel = grpc.insecure_channel("<host>")stub = hs.PredictionServiceStub(channel)# 1. define a model, that you'll usemodel_spec = hs.ModelSpec(name="model")# 2. define tensor_shape for Tensor instancetensor_shape = hs.TensorShapeProto( dim=[hs.TensorShapeProto.Dim(size=-1), hs.TensorShapeProto.Dim(size=2)])# 3. define tensor with needed datatensor = hs.TensorProto(dtype=hs.DT_DOUBLE, tensor_shape=tensor_shape, double_val=[1,1,1,1])# 4. create PredictRequest instancerequest = hs.PredictRequest(model_spec=model_spec, inputs={"x": tensor})# call Predict methodresult = stub.Predict(request)