code: def generate(dest_dir: Path):
      template_dir = icevision_dir / "docs" / "templates"
      template_images_dir = Path(template_dir) / "images"
  
      # Create dest_dir if doesn't exist
      if os.path.exists(dest_dir):
          print("Removing sources folder:", dest_dir)
          logger.opt(colors=True).log(
              "INFO",
              "️<magenta><bold>\nRemoving sources folder: {}</></>",
              dest_dir,
          )
          shutil.rmtree(dest_dir)
      os.makedirs(dest_dir)
  
      # Copy images folder from root folder to the template images folder
      copy_tree(str(icevision_dir / "images"), str(template_images_dir))
      from_to = f"root/images -> docs/images"
      logger.opt(colors=True).log(
          "INFO",
          "️<green><bold>\nCopying images folder: {}</></>",
          from_to,
      )
  
      # Generate APIs Documentation
      doc_generator = keras_autodoc.DocumentationGenerator(
          pages=PAGES,
          project_url="https://github.com/airctic/icevision/blob/master",
          template_dir=template_dir,
          # examples_dir=icevision_dir / "examples",
      )
      doc_generator.generate(dest_dir)
  
      # Copy CNAME file
      shutil.copyfile(icevision_dir / "CNAME", dest_dir / "CNAME")
  
      # Copy web manifest
      shutil.copyfile(
          "manifest.webmanifest", dest_dir / "manifest.webmanifest"
      )
      from_to = (
          f"root/manifest.webmanifest -> docs/manifest.webmanifest"
      )
      logger.opt(colors=True).log(
          "INFO",
          "️<green><bold>\nCopying webmanifest file: {}</></>",
          from_to,
      )
  
      # Auto generate the index.md file using the README.md file and the index.md file in templates folder
      readme = (icevision_dir / "README.md").read_text()
  
      # Search for the beginning and the end of the installation procedure to hide in Docs to avoid duplication
      start = readme.find("<!-- Not included in docs - start -->")
      end = readme.find("<!-- Not included in docs - end -->")
  
      readme = readme.replace(readme[start:end], "")
      index = (template_dir / "index.md").read_text()
      index = index.replace(
          "{{autogenerated}}", readme[readme.find("##") :]
      )
      (dest_dir / "index.md").write_text(index, encoding="utf-8")
  
      # Copy static .md files from the root folder
      dir_to_search = icevision_dir
      fnamelist = [
          filename
          for filename in os.listdir(dir_to_search)
          if filename.endswith(".md")
      ]
      logger.opt(colors=True).log(
          "INFO",
          "️<green><bold>\nCopying .md files root folder: {}</></>",
          fnamelist,
      )
  
      for fname in fnamelist:
          fname_src = icevision_dir / fname
          fname_dst = dest_dir / fname.lower()
          shutil.copyfile(fname_src, fname_dst)
          from_to = f"{fname} -> {fname.lower()}"
          logger.opt(colors=True).log(
              "INFO",
              "️<light-blue><bold>file: {}</></>",
              from_to,
          )
  
      # Copy static .md files from the docs folder
      dir_to_search = icevision_dir / "docs"
      fnamelist = [
          filename
          for filename in os.listdir(dir_to_search)
          if filename.endswith(".md")
      ]
      logger.opt(colors=True).log(
          "INFO",
          "️<green><bold>\nCopying .md files from the docs folder: {}</></>",
          fnamelist,
      )
      for fname in fnamelist:
          fname_src = dir_to_search / fname
          fname_dst = dest_dir / fname.lower()
          shutil.copyfile(fname_src, fname_dst)
          from_to = f"{fname} -> {fname.lower()}"
          logger.opt(colors=True).log(
              "INFO",
              "️<light-blue><bold>Copying files: {}</></>",
              from_to,
          )
  
      # Copy images folder from the template folder to the destination folder
      # print("Template folder: ", template_images_dir)
      dest_images_dir = Path(dest_dir) / "images"
  
      # Copy images folder
      copy_tree(str(template_images_dir), str(dest_images_dir))
      from_to = f"{template_images_dir} -> {dest_images_dir}"
      logger.opt(colors=True).log(
          "INFO",
          "️<green><bold>Copying Images: {}</></>",
          from_to,
      )
  
      # Copy css folder
      css_dir_src = str(icevision_dir / "docs/css")
      css_dir_dest = str(str(dest_dir / "css"))
      copy_tree(css_dir_src, css_dir_dest)
      from_to = f"{css_dir_src} -> {css_dir_dest}"
      logger.opt(colors=True).log(
          "INFO",
          "️<green><bold>Copying CSS files: {}</></>",
          from_to,
      )
  
      # Copy js folder
      # copy_tree(str(icevision_dir / "docs/js"), str(dest_dir / "js"))
      js_dir_src = str(icevision_dir / "docs/js")
      js_dir_dest = str(str(dest_dir / "js"))
      copy_tree(js_dir_src, js_dir_dest)
      from_to = f"{js_dir_src} -> {js_dir_dest}"
      logger.opt(colors=True).log(
          "INFO",
          "️<green><bold>Copying JS files: {}</></>",
          from_to,
      )
  
      # Generate .md files form Jupyter Notebooks located in the /notebooks folder
      nb_to_md(icevision_dir, "notebooks", dest_dir)
  
      # Generate .md files form Jupyter Notebooks located in the /deployment folder
      nb_to_md(icevision_dir / "docs", "deployment", dest_dir)
  
      # albumentations
      shutil.copyfile(
          icevision_dir / "icevision/tfms/README.md",
          dest_dir / "albumentations.md",
      )
  
      # Models
      shutil.copyfile(
          icevision_dir / "icevision/models/README.md",
          dest_dir / "models.md",
      )
  
      # README DOCS
      shutil.copyfile(
          icevision_dir / "docs/README.md",
          dest_dir / "readme_mkdocs.md",
      )
  
file_path: icevision/docs/autogen.py
imports: import os
  from pathlib import Path
  import shutil
  from distutils.dir_util import copy_tree
  import keras_autodoc
  import tutobooks
  from loguru import logger
label_desc: Use image node_id 6 for calling a global function with example usage: generate(dest_dir) without return types