code: def add_annotations(samples: List[dict]) -> List[dict]:
      """
      Adds a `text` field to the sample dict to use as annotations when plotting.
      """
      for sample in samples:
          text = ""
          for key in sample.losses.keys():
              if "loss" in key:
                  text += f"{key}: {round(sample.losses[key], 5)}\n"
          text += f"IMG: {sample.filepath.name}"
          sample.losses["text"] = text
      return samples
  
file_path: icevision/icevision/models/interpretation.py
imports: from icevision.imports import *
  from icevision.utils import *
  from icevision.core import *
  from icevision.data import *
  from icevision.visualize.show_data import show_preds
  from icevision.core.record_components import LossesRecordComponent
label_desc: Use image node_id 6 for calling a global function with example usage: add_annotations(samples) and returns: samples