code: def _gen_input(
      name: str, params: T.Any, model: "IOBase"
  ) -> "Request":
      if model is None:
          if isinstance(params, bytes):
              model = BYTES()
          elif isinstance(params, np.ndarray):
              model = NDARRAY()
          elif isinstance(params, str):
              model = TEXT()
          else:
              model = JSON()
  
      if params is None:
          return service_pb2.Request(path=name)
      return service_pb2.Request(
          path=name, content=model.to_proto(params)
      )
  
file_path: towhee/towhee/serve/grpc/client.py
imports: import typing
  from pydantic import BaseModel
  import numpy
  from towhee.utils.thirdparty.grpc_utils import grpc
  from .None import service_pb2
  from .None import service_pb2_grpc
  from towhee.serve.io import JSON, TEXT, NDARRAY, BYTES
label_desc: Use image node_id 2 for calling a global function with example usage: _gen_input(name, params, model) and returns: service_pb2, service_pb2