docs: def local_predict(training_dir, data):
    """Runs local prediction on the prediction graph.
  
    Runs local prediction and returns the result in a Pandas DataFrame. For
    running prediction on a large dataset or saving the results, run
    local_batch_prediction or batch_prediction. Input data should fully match
    the schema that was used at training, except the target column should not
    exist.
  
    Args:
      training_dir: local path to the trained output folder.
      data: List of csv strings or a Pandas DataFrame that match the model schema.
  
    Raises:
      ValueError: if training_dir does not contain the folder 'model'.
      FileNotFoundError: if the prediction data is not found.
  
    """
    # from . import predict as predict_module
    from .prediction import predict as predict_module
  
    # Save the instances to a file, call local batch prediction, and return it
    tmp_dir = tempfile.mkdtemp()
    _, input_file_path = tempfile.mkstemp(dir=tmp_dir, suffix='.csv',
                                          prefix='input')
  
    try:
      if isinstance(data, pd.DataFrame):
        data.to_csv(input_file_path, header=False, index=False)
      else:
        with open(input_file_path, 'w') as f:
          for line in data:
            f.write(line + '\n')
  
      model_dir = os.path.join(training_dir, 'model')
      if not file_io.file_exists(model_dir):
        raise ValueError('training_dir should contain the folder model')
  
      cmd = ['predict.py',
             '--predict-data=%s' % input_file_path,
             '--trained-model-dir=%s' % model_dir,
             '--output-dir=%s' % tmp_dir,
             '--output-format=csv',
             '--batch-size=16',
             '--mode=prediction',
             '--no-shard-files']
  
      # runner_results = predict_module.predict.main(cmd)
      runner_results = predict_module.main(cmd)
      runner_results.wait_until_finish()
  
      # Read the header file.
      schema_file = os.path.join(tmp_dir, 'csv_schema.json')
      with open(schema_file, 'r') as f:
        schema = json.loads(f.read())
  
      # Print any errors to the screen.
      errors_file = glob.glob(os.path.join(tmp_dir, 'errors*'))
      if errors_file and os.path.getsize(errors_file[0]) > 0:
        print('Warning: there are errors. See below:')
        with open(errors_file[0], 'r') as f:
          text = f.read()
          print(text)
  
      # Read the predictions data.
      prediction_file = glob.glob(os.path.join(tmp_dir, 'predictions*'))
      if not prediction_file:
        raise FileNotFoundError('Prediction results not found')
      predictions = pd.read_csv(prediction_file[0],
                                header=None,
                                names=[col['name'] for col in schema])
      return predictions
    finally:
      shutil.rmtree(tmp_dir)