class_docstr: Packs metadata and associated files into TensorFlow Lite model file.
  
  MetadataPopulator can be used to populate metadata and model associated files
  into a model file or a model buffer (in bytearray). It can also help to
  inspect list of files that have been packed into the model or are supposed to
  be packed into the model.
  
  The metadata file (or buffer) should be generated based on the metadata
  schema:
  mediapipe/tasks/metadata/metadata_schema.fbs
  
  Example usage:
  Populate metadata and label file into an image classifier model.
  
  First, based on metadata_schema.fbs, generate the metadata for this image
  classifier model using Flatbuffers API. Attach the label file onto the output
  tensor (the tensor of probabilities) in the metadata.
  
  Then, pack the metadata and label file into the model as follows.
  
    ```python
    # Populating a metadata file (or a metadata buffer) and associated files to
    a model file:
    populator = MetadataPopulator.with_model_file(model_file)
    # For metadata buffer (bytearray read from the metadata file), use:
    # populator.load_metadata_buffer(metadata_buf)
    populator.load_metadata_file(metadata_file)
    populator.load_associated_files([label.txt])
    # For associated file buffer (bytearray read from the file), use:
    # populator.load_associated_file_buffers({"label.txt": b"file content"})
    populator.populate()
  
    # Populating a metadata file (or a metadata buffer) and associated files to
    a model buffer:
    populator = MetadataPopulator.with_model_buffer(model_buf)
    populator.load_metadata_file(metadata_file)
    populator.load_associated_files([label.txt])
    populator.populate()
    # Writing the updated model buffer into a file.
    updated_model_buf = populator.get_model_buffer()
    with open("updated_model.tflite", "wb") as f:
      f.write(updated_model_buf)
  
    # Transferring metadata and associated files from another TFLite model:
    populator = MetadataPopulator.with_model_buffer(model_buf)
    populator_dst.load_metadata_and_associated_files(src_model_buf)
    populator_dst.populate()
    updated_model_buf = populator.get_model_buffer()
    with open("updated_model.tflite", "wb") as f:
      f.write(updated_model_buf)
    ```
  
  Note that existing metadata buffer (if applied) will be overridden by the new
  metadata buffer.
class_docstr_tok: ["Packs","metadata","and","associated","files","into","TensorFlow","Lite","model","file",".","MetadataPopulator","can","be","used","to","populate","metadata","and","model","associated","files","into","a","model","file","or","a","model","buffer","(","in","bytearray",")",".","It","can","also","help","to","inspect","list","of","files","that","have","been","packed","into","the","model","or","are","supposed","to","be","packed","into","the","model",".","The","metadata","file","(","or","buffer",")","should","be","generated","based","on","the","metadata","schema",":","mediapipe\/tasks\/metadata\/metadata_schema.fbs","Example","usage",":","Populate","metadata","and","label","file","into","an","image","classifier","model",".","First",",","based","on","metadata_schema.fbs",",","generate","the","metadata","for","this","image","classifier","model","using","Flatbuffers","API",".","Attach","the","label","file","onto","the","output","tensor","(","the","tensor","of","probabilities",")","in","the","metadata",".","Then",",","pack","the","metadata","and","label","file","into","the","model","as","follows",".","``","`","python","#","Populating","a","metadata","file","(","or","a","metadata","buffer",")","and","associated","files","to","a","model","file",":","populator","=","MetadataPopulator.with_model_file","(","model_file",")","#","For","metadata","buffer","(","bytearray","read","from","the","metadata","file",")",",","use",":","#","populator.load_metadata_buffer","(","metadata_buf",")","populator.load_metadata_file","(","metadata_file",")","populator.load_associated_files","(","[","label.txt","]",")","#","For","associated","file","buffer","(","bytearray","read","from","the","file",")",",","use",":","#","populator.load_associated_file_buffers","(","{","``","label.txt","''",":","b","''","file","content","''","}",")","populator.populate","(",")","#","Populating","a","metadata","file","(","or","a","metadata","buffer",")","and","associated","files","to","a","model","buffer",":","populator","=","MetadataPopulator.with_model_buffer","(","model_buf",")","populator.load_metadata_file","(","metadata_file",")","populator.load_associated_files","(","[","label.txt","]",")","populator.populate","(",")","#","Writing","the","updated","model","buffer","into","a","file",".","updated_model_buf","=","populator.get_model_buffer","(",")","with","open","(","``","updated_model.tflite","''",",","``","wb","''",")","as","f",":","f.write","(","updated_model_buf",")","#","Transferring","metadata","and","associated","files","from","another","TFLite","model",":","populator","=","MetadataPopulator.with_model_buffer","(","model_buf",")","populator_dst.load_metadata_and_associated_files","(","src_model_buf",")","populator_dst.populate","(",")","updated_model_buf","=","populator.get_model_buffer","(",")","with","open","(","``","updated_model.tflite","''",",","``","wb","''",")","as","f",":","f.write","(","updated_model_buf",")","``","`","Note","that","existing","metadata","buffer","(","if","applied",")","will","be","overridden","by","the","new","metadata","buffer","."]
docstr: Gets the buffer of the model with packed metadata and associated files.
  
  Returns:
    Model buffer (in bytearray).
docstr_tok: ["Gets","the","buffer","of","the","model","with","packed","metadata","and","associated","files",".","Returns",":","Model","buffer","(","in","bytearray",")","."]
code: def get_model_buffer(self):
      """Gets the buffer of the model with packed metadata and associated files.
  
      Returns:
        Model buffer (in bytearray).
      """
      with _open_file(self._model_file, "rb") as f:
          return f.read()
  
imports: import copy
  import inspect
  import io
  import json
  import logging
  import os
  import shutil
  import sys
  import tempfile
  from typing import Dict, Optional
  import warnings
  import zipfile
  import flatbuffers
  from mediapipe.tasks.cc.metadata.python import _pywrap_metadata_version
  from mediapipe.tasks.metadata import metadata_schema_py_generated
  from mediapipe.tasks.metadata import schema_py_generated
  from mediapipe.tasks.python.metadata.flatbuffers_lib import _pywrap_flatbuffers
label_desc: Use image node_id 4 for calling the MetadataPopulator obj's underlying member method code with example usage: obj.get_model_buffer() and returns: f