code: def show_anns(anns):
      if len(anns) == 0:
          return
      for i in range(len(anns)):
          anns[i]["segmentation"] = coco_mask.decode(
              anns[i]["segmentation"]
          )
      sorted_anns = sorted(
          anns, key=(lambda x: x["area"]), reverse=True
      )
      ax = plt.gca()
      ax.set_autoscale_on(False)
  
      img = np.ones(
          (
              sorted_anns[0]["segmentation"].shape[0],
              sorted_anns[0]["segmentation"].shape[1],
              4,
          )
      )
      img[:, :, 3] = 0
      for ann in sorted_anns:
          m = ann["segmentation"].astype(bool)
          color_mask = np.concatenate([np.random.random(3), [0.35]])
          img[m] = color_mask
      ax.imshow(img)
  
file_path: serve/examples/large_models/segment_anything_fast/inference.py
imports: import base64
  import pickle
  import cv2
  import matplotlib.pyplot
  import numpy
  import requests
  from pycocotools import mask
label_desc: Use image node_id 1 for calling a global function with example usage: show_anns(anns) without return types