class_docstr: GRPCServer test
class_docstr_tok: ["GRPCServer","test"]
code: def test_ndarray_io(self):
      service = api_service.APIService(desc="test")
  
      @service.api(path="/test", output_model=NDARRAY())
      def test():
          return np.random.rand(1024)
  
      @service.api(
          path="/echo", input_model=NDARRAY(), output_model=NDARRAY()
      )
      def test2(arr: "ndarray"):
          return arr
  
      @service.api(path="/unkown_model", output_model=NDARRAY())
      def test3(arr: "ndarray"):
          return arr
  
      self.server = GRPCServer(service)
  
      self.server.start("localhost", 50001)
      with Client("localhost", 50001) as client:
          response = client("/test")
          self.assertTrue(isinstance(response.content, np.ndarray))
  
          arr = np.random.rand(1024)
          response = client("/echo", arr, NDARRAY())
          self.assertTrue(np.array_equal(arr, response.content))
  
          response = client("/echo", arr)
          self.assertTrue(np.array_equal(arr, response.content))
  
          response = client("/unkown_model", arr)
          self.assertTrue(np.array_equal(arr, response.content))
  
          with self.assertRaises(AssertionError):
              client("/echo", "error_type", NDARRAY())
  
      # async client
      async def call():
          async with AsyncClient("localhost", 50001) as aclient:
              response = await aclient("/test")
              self.assertTrue(isinstance(response.content, np.ndarray))
  
              arr = np.random.rand(1024)
              response = await aclient("/echo", arr, NDARRAY())
              self.assertTrue(np.array_equal(arr, response.content))
  
              response = await aclient("/echo", arr)
              self.assertTrue(np.array_equal(arr, response.content))
  
              response = await aclient("/unkown_model", arr)
              self.assertTrue(np.array_equal(arr, response.content))
  
              with self.assertRaises(AssertionError):
                  await aclient("/echo", "error_type", NDARRAY())
  
      async def run():
          await asyncio.gather(call(), call(), call())
  
      asyncio.run(run())
  
imports: import unittest
  import typing
  import asyncio
  from pydantic import BaseModel
  import numpy
  from towhee import api_service, pipe
  from towhee.serve.grpc.server import GRPCServer
  from towhee.serve.grpc.client import Client, AsyncClient
  from towhee.serve.io import JSON, NDARRAY, BYTES
  from towhee.utils.serializer import from_json
label_desc: Use image node_id 8 for calling the TestGRPC obj's underlying member method code with example usage: obj.test_ndarray_io() and returns: np, arr, arr