docstr: Load a theme from the hub.
  
  This DOES NOT require a HuggingFace account for downloading publicly available themes.
  
  Parameters:
      repo_name: string of the form <author>/<theme-name>@<semantic-version-expression>.  If a semantic version expression is omitted, the latest version will be fetched.
      hf_token: HuggingFace Token. Only needed to download private themes.
docstr_tok: ["Load","a","theme","from","the","hub",".","This","DOES","NOT","require","a","HuggingFace","account","for","downloading","publicly","available","themes",".","Parameters",":","repo_name",":","string","of","the","form","<","author",">","\/","<","theme-name",">","@","<","semantic-version-expression",">",".","If","a","semantic","version","expression","is","omitted",",","the","latest","version","will","be","fetched",".","hf_token",":","HuggingFace","Token",".","Only","needed","to","download","private","themes","."]
code: def from_hub(cls, repo_name: str, hf_token: str | None = None):
      """Load a theme from the hub.
  
      This DOES NOT require a HuggingFace account for downloading publicly available themes.
  
      Parameters:
          repo_name: string of the form <author>/<theme-name>@<semantic-version-expression>.  If a semantic version expression is omitted, the latest version will be fetched.
          hf_token: HuggingFace Token. Only needed to download private themes.
      """
      if "@" not in repo_name:
          name, version = repo_name, None
      else:
          name, version = repo_name.split("@")
  
      api = huggingface_hub.HfApi(token=hf_token)
  
      try:
          space_info = api.space_info(name)
      except huggingface_hub.utils._errors.RepositoryNotFoundError as e:
          raise ValueError(f"The space {name} does not exist") from e
  
      assets = get_theme_assets(space_info)
      matching_version = get_matching_version(assets, version)
  
      if not matching_version:
          raise ValueError(
              f"Cannot find a matching version for expression {version} "
              f"from files {[f.filename for f in assets]}"
          )
  
      theme_file = huggingface_hub.hf_hub_download(
          repo_id=name,
          repo_type="space",
          filename=f"themes/theme_schema@{matching_version.version}.json",
      )
      theme = cls.load(theme_file)
      theme.name = name
      return theme
  
imports: from __future__ import annotations
  import json
  import re
  import tempfile
  import textwrap
  from pathlib import Path
  from typing import Iterable
  import huggingface_hub
  import semantic_version
  from gradio_client.documentation import document, set_documentation_group
  from huggingface_hub import CommitOperationAdd
  from gradio.themes.utils import colors, fonts, get_matching_version, get_theme_assets, sizes
  from gradio.themes.utils.readme_content import README_CONTENT
label_desc: Use image node_id 7 for calling the ThemeClass obj's underlying member method code with example usage: obj.from_hub(cls, repo_name, hf_token) and returns: theme