def get_prediction(placeholder,
                   tf_example,
                   sess,
                   outputs,
                   vocab,
                   beam_size,
                   restore_preds_from_asql=False,
                   clean_vocab=None):
  """Gets predicted outputs for a specific input to the model."""
  copy_strings = _get_copy_strings(tf_example)
  segment_ids = _get_segment_ids(tf_example)

  feed_dict = {placeholder: tf_example.SerializeToString()}
  output_vals = sess.run(outputs, feed_dict=feed_dict)

  predictions = list()
  scores = list()
  for index in range(beam_size):
    prediction, score = clean_predicted_sequence(
        output_vals['predicted_action_ids'][index],
        output_vals['predicted_action_types'][index],
        output_vals['scores'][index],
        vocab,
        copy_strings,
        segment_ids,
        restore_preds_from_asql=restore_preds_from_asql,
        clean_vocab=clean_vocab)
    predictions.append(prediction)
    scores.append(score)
  return predictions, scores
Gets predicted outputs for a specific input to the model.
language/xsp/model/run_inference.py