class_docstr: This class is a wrapper over the Dataset component and can be used to create Examples
  for Blocks / Interfaces. Populates the Dataset component with examples and
  assigns event listener so that clicking on an example populates the input/output
  components. Optionally handles example caching for fast inference.
  
  Demos: blocks_inputs, fake_gan
  Guides: more-on-examples-and-flagging, using-hugging-face-integrations, image-classification-in-pytorch, image-classification-in-tensorflow, image-classification-with-vision-transformers, create-your-own-friends-with-a-gan
docstr: Caches the examples if self.cache_examples is True and creates the Dataset
  component to hold the examples
docstr_tok: ["Caches","the","examples","if","self.cache_examples","is","True","and","creates","the","Dataset","component","to","hold","the","examples"]
code: def create(self) -> None:
      """Caches the examples if self.cache_examples is True and creates the Dataset
      component to hold the examples"""
  
      async def load_example(example_id):
          processed_example = self.non_none_processed_examples[
              example_id
          ]
          if len(self.inputs_with_examples) == 1:
              return update(
                  value=processed_example[0],
                  **self.dataset.component_props[0],
              )
          return [
              update(
                  value=processed_example[i],
                  **self.dataset.component_props[i],
              )
              for i in range(len(self.inputs_with_examples))
          ]
  
      if Context.root_block:
          self.load_input_event = self.dataset.click(
              load_example,
              inputs=[self.dataset],
              outputs=self.inputs_with_examples,  # type: ignore
              show_progress="hidden",
              postprocess=False,
              queue=False,
              api_name=self.api_name,
              show_api=False,
          )
          if self.run_on_click and not self.cache_examples:
              if self.fn is None:
                  raise ValueError(
                      "Cannot run_on_click if no function is provided"
                  )
              self.load_input_event.then(
                  self.fn,
                  inputs=self.inputs,  # type: ignore
                  outputs=self.outputs,  # type: ignore
                  show_api=False,
              )
  
      if self.cache_examples:
          if wasm_utils.IS_WASM:
              # In the Wasm mode, the `threading` module is not supported,
              # so `client_utils.synchronize_async` is also not available.
              # And `self.cache()` should be waited for to complete before this method returns,
              # (otherwise, an error "Cannot cache examples if not in a Blocks context" will be raised anyway)
              # so `eventloop.create_task(self.cache())` is also not an option.
              raise wasm_utils.WasmUnsupportedError(
                  "Caching examples is not supported in the Wasm mode."
              )
          client_utils.synchronize_async(self.cache)
  
imports: from __future__ import annotations
  import ast
  import csv
  import inspect
  import os
  import shutil
  import subprocess
  import tempfile
  import warnings
  from functools import partial
  from pathlib import Path
  from typing import TYPE_CHECKING, Any, Callable, Iterable, Literal, Optional
  import matplotlib.pyplot
  import numpy
  import PIL
  import PIL.Image
  from gradio_client import utils
  from gradio_client.documentation import document, set_documentation_group
  from matplotlib import animation
  from gradio import components, oauth, processing_utils, routes, utils, wasm_utils
  from gradio.context import Context, LocalContext
  from gradio.data_classes import GradioModel, GradioRootModel
  from gradio.events import EventData
  from gradio.exceptions import Error
  from gradio.flagging import CSVLogger
label_desc: Use image node_id 2 for calling the Examples obj's underlying member method code with example usage: obj.create() and returns: unknown, update