code: def export_model(module_spec, class_count, saved_model_dir):
    
    # The SavedModel should hold the eval graph.
    sess, in_image, _, _, _, _ = build_eval_session(module_spec, class_count)
    with sess.graph.as_default() as graph:
      tf.saved_model.simple_save(
          sess,
          saved_model_dir,
          inputs={'image': in_image},
          outputs={'prediction': graph.get_tensor_by_name('final_result:0')},
          legacy_init_op=tf.group(tf.tables_initializer(), name='legacy_init_op')
      )
docs: Exports model for serving.
  
    Args:
      module_spec: The hub.ModuleSpec for the image module being used.
      class_count: The number of classes.
      saved_model_dir: Directory in which to save exported model and variables.