code: def test_server_integration_with_audio(single_record, tmpdir):
      # Audio Inputs
      audio_dest_folder = os.path.join(tmpdir, "generated_audio")
  
      # Resnet encoder
      input_features = [
          audio_feature(
              folder=audio_dest_folder,
          ),
          text_feature(encoder={"type": "embed", "min_len": 1}),
          number_feature(normalization="zscore"),
      ]
      output_features = [
          category_feature(decoder={"vocab_size": 4}),
          number_feature(),
      ]
  
      rel_path = generate_data(
          input_features,
          output_features,
          os.path.join(tmpdir, "dataset.csv"),
      )
  
      model = train_and_predict_model(
          input_features,
          output_features,
          data_csv=rel_path,
          output_directory=tmpdir,
      )
  
      app = server(model)
      client = TestClient(app)
      response = client.get("/")
      assert response.status_code == 200
  
      response = client.post("/predict")
      # expect the HTTP 400 error code for this situation
      assert response.status_code == 400
      assert ALL_FEATURES_PRESENT_ERROR in str(response.json())
  
      data_df = read_csv(rel_path)
  
      if single_record:
          # Single record prediction
          first_entry = data_df.T.to_dict()[0]
          data, files = convert_to_form(first_entry)
          server_response = client.post(
              "/predict", data=data, files=files
          )
          assert server_response.status_code == 200
          server_response = server_response.json()
  
          server_response_keys = sorted(list(server_response.keys()))
          assert server_response_keys == sorted(
              output_keys_for(output_features)
          )
  
          model_output, _ = model.predict(
              dataset=[first_entry], data_format=dict
          )
          model_output = model_output.to_dict("records")[0]
          assert model_output == server_response
      else:
          # Batch prediction
          assert len(data_df) > 1
          files = convert_to_batch_form(data_df)
          server_response = client.post("/batch_predict", files=files)
          assert server_response.status_code == 200
          server_response = server_response.json()
  
          server_response_keys = sorted(server_response["columns"])
          assert server_response_keys == sorted(
              output_keys_for(output_features)
          )
          assert len(data_df) == len(server_response["data"])
  
          model_output, _ = model.predict(dataset=data_df)
          model_output = model_output.to_dict("split")
          assert model_output == server_response
  
file_path: ludwig/tests/integration_tests/test_server.py
imports: import json
  import logging
  import os
  import sys
  import numpy
  import pytest
  from ludwig.api import LudwigModel
  from ludwig.constants import BATCH_SIZE, DECODER, TRAINER
  from ludwig.serve import server
  from ludwig.utils.data_utils import read_csv
  from tests.integration_tests.utils import audio_feature, category_feature, generate_data, image_feature, LocalTestBackend, number_feature, text_feature
label_desc: Use image node_id 8 for calling a global function with example usage: test_server_integration_with_audio(single_record, tmpdir) without return types