class_docstr: Generic Metadata writer.
  
  Example usage:
  
  For an example model which requires two inputs: image and general feature
  inputs, and generates one output: classification.
  
  with open(model_path, 'rb') as f:
    writer = MetadataWriter.create(f.read())
    model_content, metadata_json_content = writer
        .add_genernal_info('model_name', 'model description')
        .add_image_input()
        .add_feature_input()
        .add_classification_output(Labels().add(['A', 'B']))
        .populate()
class_docstr_tok: ["Generic","Metadata","writer",".","Example","usage",":","For","an","example","model","which","requires","two","inputs",":","image","and","general","feature","inputs",",","and","generates","one","output",":","classification",".","with","open","(","model_path",",","'rb","'",")","as","f",":","writer","=","MetadataWriter.create","(","f.read","(",")",")","model_content",",","metadata_json_content","=","writer",".add_genernal_info","(","'model_name","'",",","'model","description","'",")",".add_image_input","(",")",".add_feature_input","(",")",".add_classification_output","(","Labels","(",")",".add","(","[","'","A","'",",","'","B","'","]",")",")",".populate","(",")"]
docstr: Populates metadata into the TFLite file.
  
  Note that only the output tflite is used for deployment. The output JSON
  content is used to interpret the metadata content.
  
  Returns:
    A tuple of (model_with_metadata_in_bytes, metadata_json_content)
code: def populate(self) -> Tuple[bytearray, str]:
      """Populates metadata into the TFLite file.
  
      Note that only the output tflite is used for deployment. The output JSON
      content is used to interpret the metadata content.
  
      Returns:
        A tuple of (model_with_metadata_in_bytes, metadata_json_content)
      """
      # Populates metadata and associated files into TFLite model buffer.
      populator = metadata.MetadataPopulator.with_model_buffer(
          self._model_buffer
      )
      metadata_buffer = _create_metadata_buffer(
          model_buffer=self._model_buffer,
          general_md=self._general_md,
          input_md=self._input_mds,
          output_md=self._output_mds,
          input_process_units=self._input_process_units,
          custom_metadata_md=self._custom_metadata_mds,
          output_group_md=self._output_group_mds,
      )
      populator.load_metadata_buffer(metadata_buffer)
      if self._associated_files:
          populator.load_associated_files(self._associated_files)
      populator.populate()
      tflite_content = populator.get_model_buffer()
  
      displayer = metadata.MetadataDisplayer.with_model_buffer(
          tflite_content
      )
      metadata_json_content = displayer.get_metadata_json()
  
      return tflite_content, metadata_json_content
  
imports: import collections
  import csv
  import dataclasses
  import os
  import tempfile
  from typing import List, Optional, Tuple, Union
  import flatbuffers
  from mediapipe.tasks.metadata import metadata_schema_py_generated
  from mediapipe.tasks.python.metadata import metadata
  from mediapipe.tasks.python.metadata.metadata_writers import metadata_info
  from mediapipe.tasks.python.metadata.metadata_writers import writer_utils
label_desc: Use image node_id 15 for calling the MetadataWriter obj's underlying member method code with example usage: obj.populate() and returns: tflite_content,  metadata_json_content