code: def compress(args):
      """Compresses an image."""
      # Load model and use it to compress the image.
      model = tf.keras.models.load_model(args.model_path)
      x = read_png(args.input_file)
      tensors = model.compress(x)
  
      # Write a binary file with the shape information and the compressed string.
      packed = tfc.PackedTensors()
      packed.pack(tensors)
      with open(args.output_file, "wb") as f:
          f.write(packed.string)
  
      # If requested, decompress the image and measure performance.
      if args.verbose:
          x_hat = model.decompress(*tensors)
  
          # Cast to float in order to compute metrics.
          x = tf.cast(x, tf.float32)
          x_hat = tf.cast(x_hat, tf.float32)
          mse = tf.reduce_mean(tf.math.squared_difference(x, x_hat))
          psnr = tf.squeeze(tf.image.psnr(x, x_hat, 255))
          msssim = tf.squeeze(tf.image.ssim_multiscale(x, x_hat, 255))
          msssim_db = (
              -10.0 * tf.math.log(1 - msssim) / tf.math.log(10.0)
          )
  
          # The actual bits per pixel including entropy coding overhead.
          num_pixels = tf.reduce_prod(tf.shape(x)[:-1])
          bpp = len(packed.string) * 8 / num_pixels
  
          print(f"Mean squared error: {mse:0.4f}")
          print(f"PSNR (dB): {psnr:0.2f}")
          print(f"Multiscale SSIM: {msssim:0.4f}")
          print(f"Multiscale SSIM (dB): {msssim_db:0.2f}")
          print(f"Bits per pixel: {bpp:0.4f}")
  
imports: import argparse
  import glob
  import sys
  from absl import app
  from absl.flags import argparse_flags
  import tensorflow
  import tensorflow_compression
  import tensorflow_datasets
label_desc: Use image node_id 8 for calling a global function with example usage: compress(args) without return types