code: def create_table(data):
      """Create a W&B Table.
  
      - Create/decode images from URL/Base64
      - Uses spacy to translate NER span data to visualizations.
      """
      # create table object from columns
      table_df = pd.DataFrame(data)
      columns = list(table_df.columns)
      if ("spans" in table_df.columns) and ("text" in table_df.columns):
          columns.append("spans_visual")
      if "image" in columns:
          columns.append("image_visual")
      main_table = wandb.Table(columns=columns)
  
      # Convert to dictionary format to maintain order during processing
      matrix = table_df.to_dict(orient="records")
  
      # Import en_core_web_md if exists
      en_core_web_md = util.get_module(
          "en_core_web_md",
          required="part_of_speech requires `en_core_web_md` library, install with `python -m spacy download en_core_web_md`",
      )
      nlp = en_core_web_md.load(disable=["ner"])
  
      # Go through each individual row
      for _i, document in enumerate(matrix):
          # Text NER span visualizations
          if ("spans_visual" in columns) and ("text" in columns):
              # Add visuals for spans
              document["spans_visual"] = None
              doc = nlp(document["text"])
              ents = []
              if ("spans" in document) and (
                  document["spans"] is not None
              ):
                  for span in document["spans"]:
                      if (
                          ("start" in span)
                          and ("end" in span)
                          and ("label" in span)
                      ):
                          charspan = doc.char_span(
                              span["start"], span["end"], span["label"]
                          )
                          ents.append(charspan)
                  doc.ents = ents
                  document["spans_visual"] = named_entity(docs=doc)
  
          # Convert image link to wandb Image
          if "image" in columns:
              # Turn into wandb image
              document["image_visual"] = None
              if ("image" in document) and (
                  document["image"] is not None
              ):
                  isurl = urllib.parse.urlparse(
                      document["image"]
                  ).scheme in (
                      "http",
                      "https",
                  )
                  isbase64 = ("data:" in document["image"]) and (
                      ";base64" in document["image"]
                  )
                  if isurl:
                      # is url
                      try:
                          im = Image.open(
                              urllib.request.urlopen(document["image"])
                          )
                          document["image_visual"] = wandb.Image(im)
                      except urllib.error.URLError:
                          print(
                              "Warning: Image URL "
                              + str(document["image"])
                              + " is invalid."
                          )
                          document["image_visual"] = None
                  elif isbase64:
                      # is base64 uri
                      imgb64 = document["image"].split("base64,")[1]
                      try:
                          msg = base64.b64decode(imgb64)
                          buf = io.BytesIO(msg)
                          im = Image.open(buf)
                          document["image_visual"] = wandb.Image(im)
                      except base64.binascii.Error:
                          print(
                              "Warning: Base64 string "
                              + str(document["image"])
                              + " is invalid."
                          )
                          document["image_visual"] = None
                  else:
                      # is data path
                      document["image_visual"] = wandb.Image(
                          document["image"]
                      )
  
          # Create row and append to table
          values_list = list(document.values())
          main_table.add_data(*values_list)
      return main_table
  
file_path: wandb/wandb/integration/prodigy/prodigy.py
imports: import base64
  import collections.abc
  import io
  import urllib
  from copy import deepcopy
  import pandas
  from PIL import Image
  import wandb
  from wandb import util
  from wandb.plots.utils import test_missing
  from wandb.sdk.lib import telemetry
label_desc: Use image node_id 5 for calling a global function with example usage: create_table(data) and returns: main_table