code: def _attach_predict_fn(self, fastapi_app: FastAPI) -> None:
      input_type: type = self.configure_input_type()
      output_type: type = self.configure_output_type()
  
      def predict_fn_sync(request: input_type):  # type: ignore
          return self.predict(request)
  
      async def async_predict_fn(request: input_type):  # type: ignore
          return await self.predict(request)
  
      if asyncio.iscoroutinefunction(self.predict):
          fastapi_app.post("/predict", response_model=output_type)(
              async_predict_fn
          )
      else:
          fastapi_app.post("/predict", response_model=output_type)(
              predict_fn_sync
          )
  
imports: import abc
  import asyncio
  import base64
  import os
  import platform
  from typing import TYPE_CHECKING, Any, Dict, Optional
  import requests
  import uvicorn
  from fastapi import FastAPI
  from lightning_utilities.core.imports import compare_version, module_available
  from pydantic import BaseModel
  from lightning.app.core.work import LightningWork
  from lightning.app.utilities.app_helpers import Logger
  from lightning.app.utilities.imports import _is_torch_available, requires
label_desc: Use image node_id 7 for calling the PythonServer obj's underlying member method code with example usage: obj._attach_predict_fn(fastapi_app) and returns: self, unknown