def load_blocks_from_huggingface(
    name: str,
    src: str,
    hf_token: str | None = None,
    alias: str | None = None,
    provider: PROVIDER_T | None = None,
    **kwargs,
) -> Blocks:
    """Creates and returns a Blocks instance from a Hugging Face model or Space repo."""
    if hf_token is not None:
        if Context.hf_token is not None and Context.hf_token != hf_token:
            warnings.warn(
                """You are loading a model/Space with a different access token than the one you used to load a previous model/Space. This is not recommended, as it may cause unexpected behavior."""
            )
        Context.hf_token = hf_token

    if src == "spaces":
        # Spaces can read the token, so we don't want to pass it in unless the user explicitly provides it
        token = False if hf_token is None else hf_token
        blocks = from_spaces(
            name, hf_token=token, alias=alias, provider=provider, **kwargs
        )
    else:
        blocks = from_model(
            name, hf_token=hf_token, alias=alias, provider=provider, **kwargs
        )
    return blocks
Creates and returns a Blocks instance from a Hugging Face model or Space repo.
gradio/external.py