code: def test_resnet_18_inference_class(
      session_global_datadir, lightning_squeezenet1_1_obj
  ):
      from tests.core.serve.models import ClassificationInference
  
      comp = ClassificationInference(lightning_squeezenet1_1_obj)
      composit = Composition(comp=comp, TESTING=True, DEBUG=True)
      app = composit.serve(host="0.0.0.0", port=8000)
  
      with TestClient(app) as tc:
          alive = tc.get("http://127.0.0.1:8000/flashserve/alive")
          assert alive.status_code == 200
          assert alive.json() == {"alive": True}
  
          meta = tc.get("http://127.0.0.1:8000/classify/dag_json")
          assert isinstance(meta.json(), dict)
  
          meta = tc.get("http://127.0.0.1:8000/classify/meta")
          assert meta.status_code == 200
  
          with (session_global_datadir / "fish.jpg").open("rb") as f:
              imgstr = base64.b64encode(f.read()).decode("UTF-8")
          body = {
              "session": "UUID",
              "payload": {"img": {"data": imgstr}},
          }
          resp = tc.post("http://127.0.0.1:8000/classify", json=body)
          assert "result" in resp.json()
          expected = {
              "session": "UUID",
              "result": {"prediction": "goldfish, Carassius auratus"},
          }
          assert expected == resp.json()
  
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 1 for calling a global function with example usage: test_resnet_18_inference_class(session_global_datadir, lightning_squeezenet1_1_obj) without return types