code: def test_model_inference_api(workers):
      port = find_free_network_port()
      process = mp.Process(target=target_fn, args=(port, workers))
      process.start()
  
      image_path = os.path.join(
          _PROJECT_ROOT, "docs/source-app/_static/images/logo.png"
      )
      with open(image_path, "rb") as f:
          imgstr = base64.b64encode(f.read()).decode("UTF-8")
  
      session = _configure_session()
      res = session.post(
          f"http://127.0.0.1:{port}/predict", params={"data": imgstr}
      )
      process.terminate()
      # TODO: Investigate why this doesn't match exactly `imgstr`.
      assert res.json()
      process.kill()
  
imports: import base64
  import multiprocessing
  import os
  from unittest.mock import ANY, MagicMock
  import pytest
  from lightning.app.components.serve import serve
  from lightning.app.testing.helpers import _RunIf
  from lightning.app.utilities.imports import _is_numpy_available, _is_torch_available
  from lightning.app.utilities.network import _configure_session, find_free_network_port
  from tests_app import _PROJECT_ROOT
label_desc: Use image node_id 2 for calling a global function with example usage: test_model_inference_api(workers) without return types