code: def init():
      global g_tf_sess, probabilities, label_dict, input_images
      subprocess.run(
          ["git", "clone", "https://github.com/tensorflow/models/"]
      )
      sys.path.append("./models/research/slim")
  
      parser = argparse.ArgumentParser(
          description="Start a tensorflow model serving"
      )
      parser.add_argument(
          "--model_name", dest="model_name", required=True
      )
      parser.add_argument(
          "--labels_dir", dest="labels_dir", required=True
      )
      args, _ = parser.parse_known_args()
      label_dict = get_class_label_dict(args.labels_dir)
      classes_num = len(label_dict)
      tf.disable_v2_behavior()
      with slim.arg_scope(nets.inception.inception_v3_arg_scope()):
          input_images = tf.placeholder(
              tf.float32, [1, image_size, image_size, num_channel]
          )
          logits, _ = nets.inception.inception_v3(
              input_images, num_classes=classes_num, is_training=False
          )
          probabilities = tf.argmax(logits, 1)
  
      config = tf.ConfigProto()
      config.gpu_options.allow_growth = True
      g_tf_sess = tf.Session(config=config)
      g_tf_sess.run(tf.global_variables_initializer())
      g_tf_sess.run(tf.local_variables_initializer())
  
      model_path = Model.get_model_path(args.model_name)
      saver = tf.train.Saver()
      saver.restore(g_tf_sess, model_path)
  
file_path: MachineLearningNotebooks/tutorials/machine-learning-pipelines-advanced/scripts/batch_scoring.py
imports: import os
  import argparse
  import datetime
  import time
  import tensorflow.compat.v1
  from math import ceil
  import numpy
  import sys
  import shutil
  import subprocess
  import tf_slim
  from azureml.core import Run
  from azureml.core.model import Model
  from azureml.core.dataset import Dataset
  from tf_slim import nets
label_desc: Use image node_id 2 for calling a global function with example usage: init() without return types