code: def convert_to_tflite_from_file(
      saved_model_file: str,
      quantization_config: Optional[
          quantization.QuantizationConfig
      ] = None,
      supported_ops: Tuple[tf.lite.OpsSet, ...] = (
          tf.lite.OpsSet.TFLITE_BUILTINS,
      ),
      preprocess: Optional[Callable[..., Any]] = None,
      allow_custom_ops: bool = False,
  ) -> bytearray:
      """Converts the input Keras model to TFLite format.
  
      Args:
        saved_model_file: Keras model to be converted to TFLite.
        quantization_config: Configuration for post-training quantization.
        supported_ops: A list of supported ops in the converted TFLite file.
        preprocess: A callable to preprocess the representative dataset for
          quantization. The callable takes three arguments in order: feature, label,
          and is_training.
        allow_custom_ops: A boolean flag to enable custom ops in model convsion.
          Default to False.
  
      Returns:
        bytearray of TFLite model
      """
      converter = tf.lite.TFLiteConverter.from_saved_model(
          saved_model_file
      )
  
      if quantization_config:
          converter = (
              quantization_config.set_converter_with_quantization(
                  converter, preprocess=preprocess
              )
          )
  
      converter.allow_custom_ops = allow_custom_ops
      converter.target_spec.supported_ops = supported_ops
      tflite_model = converter.convert()
      return tflite_model
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import tempfile
  from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
  import numpy
  import tensorflow
  from mediapipe.model_maker.python.core.data import dataset
  from mediapipe.model_maker.python.core.utils import quantization
label_desc: Use image node_id 5 for calling a global function with example usage: convert_to_tflite_from_file(saved_model_file, quantization_config, supported_ops, preprocess, allow_custom_ops) and returns: tflite_model