def show_mm_table(input_dict: Dict[str, Any],
                  fps: int = 8,
                  sound_sr: int = 16000,
                  max_num_show=25):
  """Shows the generation result in a multimodal table."""
  generated_video = input_dict['generated_video']
  generated_video_sxs = input_dict.get('generated_video_sxs')
  condition_video = input_dict.get('condition_video')
  truth_video = input_dict.get('original_video')
  yt_ids = input_dict.get('yt_ids')
  audio = input_dict.get('audio')

  def _check_shape():
    num_columns = 1 + 1
    assert generated_video.ndim == 5, 'Video format should be [bs, t, h, w, c].'
    if condition_video is not None:
      assert generated_video.shape[0] == condition_video.shape[0]
      num_columns += 1
    if generated_video_sxs is not None:
      assert generated_video.shape == generated_video_sxs.shape
      num_columns += 1
    if truth_video is not None:
      assert generated_video.shape == truth_video.shape
      num_columns += 1
    if audio is not None:
      assert generated_video.shape[0] == audio.shape[0]
      num_columns += 1
    if yt_ids:
      assert len(yt_ids) == generated_video.shape[0]
      num_columns += 1
    return num_columns

  num_samples = min(max_num_show, generated_video.shape[0])
  num_columns = _check_shape()
  # Colabtools are not supported outside of a notebook context, so we
  # lazily import from it to avoid import errors when using this file
  # as a library.
  from colabtools import table  # pylint: disable=g-import-not-at-top
  mm_table = table.Table(rows=num_samples + 1, columns=num_columns)
  for cur_row in range(num_samples):
    cur_col = 0
    mm_table.SetActive(cur_row, cur_col)
    print(f'example {cur_row}')
    if condition_video is not None:
      cur_col += 1
      mm_table.SetActive(cur_row, cur_col)
      print('condition')
      mediapy.show_video(condition_video[cur_row], codec='gif', fps=fps)
    # generated video
    cur_col += 1
    mm_table.SetActive(cur_row, cur_col)
    print('generation')
    mediapy.show_video(generated_video[cur_row], codec='gif', fps=fps)
    if generated_video_sxs is not None:
      cur_col += 1
      mm_table.SetActive(cur_row, cur_col)
      print('gen_sxs')
      mediapy.show_video(generated_video_sxs[cur_row], codec='gif', fps=fps)
    if truth_video is not None:
      cur_col += 1
      mm_table.SetActive(cur_row, cur_col)
      print('truth')
      mediapy.show_video(truth_video[cur_row], codec='gif', fps=fps)
    if audio is not None:
      cur_col += 1
      mm_table.SetActive(cur_row, cur_col)
      from colabtools import sound  # pylint: disable=g-import-not-at-top
      sound.Play(np.squeeze(audio[cur_row]), sound_sr=sound_sr)
    if yt_ids:
      cur_col += 1
      mm_table.SetActive(cur_row, cur_col)
      yt_id = yt_ids[cur_row]
      from colabtools import publish  # pylint: disable=g-import-not-at-top
      publish.html(f'<a href="https://www.youtube.com/embed/{yt_id}?start=0' +
                   '&end=2" target="_blank">YT</a>')
Shows the generation result in a multimodal table.
videogvt/interfaces/colab_utils.py