code: def main(_):
      tf.logging.set_verbosity(tf.logging.INFO)
      validate_flags()
      usr_dir.import_usr_dir(FLAGS.t2t_usr_dir)
      problem = registry.problem(FLAGS.problem)
      hparams = hparam.HParams(
          data_dir=os.path.expanduser(FLAGS.data_dir)
      )
      problem.get_hparams(hparams)
      request_fn = make_request_fn()
      while True:
          inputs = (
              FLAGS.inputs_once if FLAGS.inputs_once else input(">> ")
          )
          outputs = serving_utils.predict([inputs], problem, request_fn)
          (outputs,) = outputs
          output, score = outputs
          if (
              len(score.shape) > 0
          ):  # pylint: disable=g-explicit-length-test
              print_str = """
  Input:
  {inputs}
  
  Output (Scores [{score}]):
  {output}
          """
              score_text = ",".join(["{:.3f}".format(s) for s in score])
              print(
                  print_str.format(
                      inputs=inputs, output=output, score=score_text
                  )
              )
          else:
              print_str = """
  Input:
  {inputs}
  
  Output (Score {score:.3f}):
  {output}
          """
              print(
                  print_str.format(
                      inputs=inputs, output=output, score=score
                  )
              )
  
          if FLAGS.inputs_once:
              break
  
file_path: tensor2tensor/tensor2tensor/serving/query.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  from oauth2client.client import GoogleCredentials
  from six.moves import input
  from tensor2tensor import problems
  from tensor2tensor.serving import serving_utils
  from tensor2tensor.utils import hparam
  from tensor2tensor.utils import registry
  from tensor2tensor.utils import usr_dir
  import tensorflow.compat.v1
label_desc: Use image node_id 3 for calling a global function with example usage: main(_) without return types