code: def test_fastapi_serialization(shutdown_ray):
      # https://github.com/ray-project/ray/issues/15511
      app = FastAPI()
  
      @serve.deployment(name="custom_service")
      @serve.ingress(app)
      class CustomService:
          def deduplicate(self, data):
              data.drop_duplicates(inplace=True)
              return data
  
          @app.post("/deduplicate")
          def _deduplicate(self, request):
              data = request["data"]
              columns = request["columns"]
              import pandas as pd
  
              data = pd.DataFrame(data, columns=columns)
              data.drop_duplicates(inplace=True)
              return data.values.tolist()
  
      serve.start()
      serve.run(CustomService.bind())
  
imports: import asyncio
  import gc
  import sys
  import numpy
  import pytest
  import requests
  from fastapi import FastAPI
  from fastapi.responses import JSONResponse
  import ray
  from ray import serve
  from ray._private.test_utils import SignalActor
  from ray.serve.context import _get_global_client
  from ray.serve.handle import DeploymentHandle
label_desc: Use image node_id 2 for calling a global function with example usage: test_fastapi_serialization(shutdown_ray) and returns: data, data