The function is used to run predictions on the audio files in the directory `pred_directory`.

    Parameters
    ----------
    net:
        The model that has been trained.
    prediction_dir: string, default ./Test
        The directory that contains the audio files on which predictions are to be made

def predict(prediction_dir='./Test'):
    """The function is used to run predictions on the audio files in the directory `pred_directory`.

    Parameters
    ----------
    net:
        The model that has been trained.
    prediction_dir: string, default ./Test
        The directory that contains the audio files on which predictions are to be made

    """

    if not os.path.exists(prediction_dir):
        warnings.warn("The directory on which predictions are to be made is not found!")
        return

    if len(os.listdir(prediction_dir)) == 0:
        warnings.warn("The directory on which predictions are to be made is empty! Exiting...")
        return

    # Loading synsets
    if not os.path.exists('./synset.txt'):
        warnings.warn("The synset or labels for the dataset do not exist. Please run the training script first.")
        return

    with open("./synset.txt", "r") as f:
        synset = [l.rstrip() for l in f]
    net = get_net(len(synset))
    print("Trying to load the model with the saved parameters...")
    if not os.path.exists("./net.params"):
        warnings.warn("The model does not have any saved parameters... Cannot proceed! Train the model first")
        return

    net.load_parameters("./net.params")
    file_names = os.listdir(prediction_dir)
    full_file_names = [os.path.join(prediction_dir, item) for item in file_names]
    from transforms import MFCC
    mfcc = MFCC()
    print("\nStarting predictions for audio files in ", prediction_dir, " ....\n")
    for filename in full_file_names:
        # Argument kaiser_fast to res_type is faster than 'kaiser_best'. To reduce the load time, passing kaiser_fast.
        X1, _ = librosa.load(filename, res_type='kaiser_fast')
        transformed_test_data = mfcc(mx.nd.array(X1))
        output = net(transformed_test_data.reshape((1, -1)))
        prediction = nd.argmax(output, axis=1)
        print(filename, " -> ", synset[(int)(prediction.asscalar())])