code: def test_composed_does_not_eliminate_endpoint_serialization(
      session_global_datadir, lightning_squeezenet1_1_obj
  ):
      from tests.core.serve.models import (
          ClassificationInference,
          SeatClassifier,
      )
  
      resnet_comp = ClassificationInference(lightning_squeezenet1_1_obj)
      seat_comp = SeatClassifier(
          lightning_squeezenet1_1_obj, config={"sport": "football"}
      )
  
      resnet_comp.outputs.prediction >> seat_comp.inputs.stadium
  
      ep = Endpoint(
          route="/predict_seat",
          inputs={
              "image": resnet_comp.inputs.img,
              "isle": seat_comp.inputs.isle,
              "section": seat_comp.inputs.section,
              "row": seat_comp.inputs.row,
          },
          outputs={
              "seat_number_out": seat_comp.outputs.seat_number,
              "team_out": seat_comp.outputs.team,
          },
      )
      ep2 = Endpoint(
          route="/predict_seat_img",
          inputs={
              "image": resnet_comp.inputs.img,
              "isle": seat_comp.inputs.isle,
              "section": seat_comp.inputs.section,
              "row": seat_comp.inputs.row,
          },
          outputs={
              "seat_number_out": seat_comp.outputs.seat_number,
              "team_out": seat_comp.outputs.team,
              "image_out": resnet_comp.outputs.prediction,
          },
      )
  
      composit = Composition(
          resnet_comp=resnet_comp,
          seat_comp=seat_comp,
          seat_prediction_ep=ep,
          seat_image_prediction_ep=ep2,
          TESTING=True,
          DEBUG=True,
      )
      app = composit.serve(host="0.0.0.0", port=8000)
  
      with TestClient(app) as tc:
          meta = tc.get("http://127.0.0.1:8000/predict_seat/meta")
          assert meta.status_code == 200
  
          meta = tc.get("http://127.0.0.1:8000/predict_seat_img/meta")
          assert meta.status_code == 200
  
          with (session_global_datadir / "cat.jpg").open("rb") as f:
              imgstr = base64.b64encode(f.read()).decode("UTF-8")
          body = {
              "session": "UUID",
              "payload": {
                  "image": {"data": imgstr},
                  "section": {"num": 10},
                  "isle": {"num": 4},
                  "row": {"num": 53},
              },
          }
          success = tc.post(
              "http://127.0.0.1:8000/predict_seat", json=body
          )
          assert success.json() == {
              "result": {
                  "seat_number_out": 4799680,
                  "team_out": "buffalo bills, the ralph",
              },
              "session": "UUID",
          }
          resp = tc.get("http://127.0.0.1:8000/predict_seat/dag")
          assert (
              resp.headers["content-type"] == "text/html; charset=utf-8"
          )
          assert resp.template.name == "dag.html"
  
file_path: lightning-flash/tests/core/serve/test_integration.py
imports: import base64
  import pytest
  from flash.core.serve import Composition, Endpoint
  from flash.core.utilities.imports import _FASTAPI_AVAILABLE, _TOPIC_SERVE_AVAILABLE
label_desc: Use image node_id 5 for calling a global function with example usage: test_composed_does_not_eliminate_endpoint_serialization(session_global_datadir, lightning_squeezenet1_1_obj) without return types