code: def grpc_request(
      stub: prediction_service_pb2_grpc.PredictionServiceStub,
      data_sample: Any,
      input_name: str,
      model_name: str,
      signature_name: str,
      callback: Optional = None,
      grpc_timeout: int = 20,
      async_: bool = False,
  ):
      request = predict_pb2.PredictRequest()
      request.model_spec.name = model_name
      request.model_spec.signature_name = signature_name
  
      request.inputs[input_name].CopyFrom(
          tf.make_tensor_proto(data_sample, shape=data_sample.shape)
      )
  
      if async_:
          result_future = stub.Predict.future(request, 5)  # 5 seconds
      else:
          result_future = stub.Predict(request, grpc_timeout)
  
      if callback is not None:
          return callback(result_future)
  
      return result_future
  
file_path: chitra/chitra/serve/tf_serving/client.py
imports: from typing import Any, Callable, Optional
  import grpc
  import tensorflow
  from tensorflow_serving.apis import predict_pb2, prediction_service_pb2_grpc
label_desc: Use image node_id 2 for calling a global function with example usage: grpc_request(stub, data_sample, input_name, model_name, signature_name, callback, grpc_timeout, async_) and returns: result_future, callback