code: def test_serving_single_component_and_endpoint_no_composition(
      session_global_datadir, lightning_squeezenet1_1_obj
  ):
      from tests.core.serve.models import ClassificationInference
  
      comp = ClassificationInference(lightning_squeezenet1_1_obj)
      assert hasattr(comp.inputs, "img")
      assert hasattr(comp.outputs, "prediction")
      assert list(comp._flashserve_meta_.connections) == []
  
      ep = Endpoint(
          route="/different_route",
          inputs={"ep_in_image": comp.inputs.img},
          outputs={"ep_out_prediction": comp.outputs.prediction},
      )
  
      assert ep.route == "/different_route"
  
      composit = Composition(comp=comp, ep=ep, 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/different_route/meta")
          assert meta.json() == {
              "definitions": {
                  "Ep_Ep_In_Image": {
                      "properties": {
                          "data": {"title": "Data", "type": "string"}
                      },
                      "required": ["data"],
                      "title": "Ep_Ep_In_Image",
                      "type": "object",
                  },
                  "Ep_Payload": {
                      "properties": {
                          "ep_in_image": {
                              "$ref": "#/definitions/Ep_Ep_In_Image"
                          }
                      },
                      "required": ["ep_in_image"],
                      "title": "Ep_Payload",
                      "type": "object",
                  },
              },
              "properties": {
                  "payload": {"$ref": "#/definitions/Ep_Payload"},
                  "session": {"title": "Session", "type": "string"},
              },
              "required": ["payload"],
              "title": "Ep_RequestModel",
              "type": "object",
          }
  
          with (session_global_datadir / "fish.jpg").open("rb") as f:
              imgstr = base64.b64encode(f.read()).decode("UTF-8")
          body = {
              "session": "UUID",
              "payload": {"ep_in_image": {"data": imgstr}},
          }
          success = tc.post(
              "http://127.0.0.1:8000/different_route", json=body
          )
          assert (
              tc.post(
                  "http://127.0.0.1:8000/classify", json=body
              ).status_code
              == 404
          )
          assert (
              tc.post(
                  "http://127.0.0.1:8000/my_test_component", json=body
              ).status_code
              == 404
          )
  
          assert "result" in success.json()
          expected = {
              "session": "UUID",
              "result": {
                  "ep_out_prediction": "goldfish, Carassius auratus"
              },
          }
          assert expected == success.json()
  
          res = tc.get("http://127.0.0.1:8000/flashserve/dag_json")
          assert res.status_code == 200
          assert res.json() == {
              "component_dependencies": {
                  "callnum_1": {
                      "callnum_1.funcout": ["callnum_1.inputs.img"],
                      "callnum_1.inputs.img": [],
                      "callnum_1.outputs.prediction": [
                          "callnum_1.funcout"
                      ],
                      "callnum_1.outputs.prediction.serial": [
                          "callnum_1.outputs.prediction"
                      ],
                  }
              },
              "component_dependents": {
                  "callnum_1": {
                      "callnum_1.funcout": [
                          "callnum_1.outputs.prediction"
                      ],
                      "callnum_1.inputs.img": ["callnum_1.funcout"],
                      "callnum_1.outputs.prediction": [
                          "callnum_1.outputs.prediction.serial"
                      ],
                      "callnum_1.outputs.prediction.serial": [],
                  }
              },
              "component_funcnames": {
                  "callnum_1": {
                      "callnum_1.funcout": ["Compose"],
                      "callnum_1.inputs.img": ["packed_deserialize"],
                      "callnum_1.outputs.prediction": ["get"],
                      "callnum_1.outputs.prediction.serial": [
                          "serialize"
                      ],
                  }
              },
              "connections": [],
          }
  
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 3 for calling a global function with example usage: test_serving_single_component_and_endpoint_no_composition(session_global_datadir, lightning_squeezenet1_1_obj) without return types