code: def test_start_server_from_composition(
      tmp_path, squeezenet_servable, session_global_datadir
  ):
      from tests.core.serve.models import (
          ClassificationInferenceComposable,
      )
  
      squeezenet_gm, _ = squeezenet_servable
      comp1 = ClassificationInferenceComposable(squeezenet_gm)
      comp2 = ClassificationInferenceComposable(squeezenet_gm)
      comp3 = ClassificationInferenceComposable(squeezenet_gm)
  
      (
          comp1.outputs.predicted_tag >> comp3.inputs.tag
      )  # skipcq: PYL-W0104
      comp2.outputs.cropped_img >> comp3.inputs.img  # skipcq: PYL-W0104
      (
          comp1.outputs.predicted_tag >> comp2.inputs.tag
      )  # skipcq: PYL-W0104
  
      ep1 = Endpoint(
          route="/predict",
          inputs={
              "img_1": comp1.inputs.img,
              "img_2": comp2.inputs.img,
              "tag_1": comp1.inputs.tag,
          },
          outputs={"prediction": comp3.outputs.predicted_tag},
      )
  
      ep2 = Endpoint(
          route="/other_predict",
          inputs={
              "img_1": comp1.inputs.img,
              "img_2": comp2.inputs.img,
              "tag_1": comp1.inputs.tag,
          },
          outputs={
              "prediction_3": comp3.outputs.predicted_tag,
              "prediction_2": comp2.outputs.cropped_img,
          },
      )
  
      composit = Composition(
          comp1=comp1,
          comp2=comp2,
          comp3=comp3,
          predict_compositon_ep=ep1,
          other_predict_ep=ep2,
          TESTING=True,
          DEBUG=True,
      )
  
      with (session_global_datadir / "cat.jpg").open("rb") as f:
          cat_imgstr = base64.b64encode(f.read()).decode("UTF-8")
      with (session_global_datadir / "fish.jpg").open("rb") as f:
          fish_imgstr = base64.b64encode(f.read()).decode("UTF-8")
      data = {
          "session": "session_uuid",
          "payload": {
              "img_1": {"data": cat_imgstr},
              "img_2": {"data": fish_imgstr},
              "tag_1": {"label": "stingray"},
          },
      }
      expected_response = {
          "result": {"prediction": "goldfish, Carassius auratus"},
          "session": "session_uuid",
      }
  
      app = composit.serve(host="0.0.0.0", port=8000)
      with TestClient(app) as tc:
          res = tc.post("http://127.0.0.1:8000/predict", json=data)
          assert res.status_code == 200
          assert res.json() == expected_response
  
file_path: lightning-flash/tests/core/serve/test_composition.py
imports: import base64
  from dataclasses import asdict
  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 9 for calling a global function with example usage: test_start_server_from_composition(tmp_path, squeezenet_servable, session_global_datadir) without return types