Skip to content

[Feat] Endpoint configure gating on a repo  #2447

Closed
@Wauplin

Description

It's possible to add a gate to a repo programmatically. It's used in the Open LLM Leaderboard for instance (see slack -internal-). It can be done like this:

from huggingface_hub.utils import build_hf_headers, get_session, hf_raise_for_status

headers = build_hf_headers()

r = get_session().put(
    url=f"https://huggingface.co/api/datasets/{repo_id}/settings",
    headers=headers,
    json={"gated": "auto"},
)
hf_raise_for_status(r)

Value can be "auto", "manual" or False.

It would be nice to add it as a new method in HfApi.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions