blogs/tf_dataflow_serving/model/inference.py
def init_predictor():
    """ Loads the TensorFlow saved model to the predictor object

    Returns:
        predictor_fn
    """

    global predictor_fn

    if predictor_fn is None:

        logging.info("Initialising predictor...")
        dir_path = os.path.dirname(os.path.realpath(__file__))
        export_dir = os.path.join(dir_path, SAVED_MODEL_DIR)

        if os.path.exists(export_dir):
            predictor_fn = tf.contrib.predictor.from_saved_model(
                export_dir=export_dir,
                signature_def_key="predict"
            )
        else:
            logging.error("Model not found! - Invalid model path: {}".format(export_dir))
 Loads the TensorFlow saved model to the predictor object

    Returns:
        predictor_fn
    
Loads the TensorFlow saved model to the predictor object
Loads the TensorFlow saved model to the predictor object
def init_predictor():
    global predictor_fn
    if predictor_fn is None:
        logging.info("Initialising predictor...")
        dir_path = os.path.dirname(os.path.realpath(__file__))
        export_dir = os.path.join(dir_path, SAVED_MODEL_DIR)
        if os.path.exists(export_dir):
            predictor_fn = tf.contrib.predictor.from_saved_model(
                export_dir=export_dir,
                signature_def_key="predict"
            )
        else:
            logging.error("Model not found! - Invalid model path: {}".format(export_dir))
def init_predictor ( ) : global predictor_fn if predictor_fn is None : logging . info ( "Initialising predictor..." ) dir_path = os . path . dirname ( os . path . realpath ( __file__ ) ) export_dir = os . path . join ( dir_path , SAVED_MODEL_DIR ) if os . path . exists ( export_dir ) : predictor_fn = tf . contrib . predictor . from_saved_model ( export_dir = export_dir , signature_def_key = "predict" ) else : logging . error ( "Model not found! - Invalid model path: {}" . format ( export_dir ) )
Loads the TensorFlow saved model to the predictor object
Loads the TensorFlow saved model to the predictor object
""" Loads the TensorFlow saved model to the predictor object

    Returns:
        predictor_fn
    """
None