File size: 353 Bytes
31112ad
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
import posixpath


def build_hf_url(repo_id, *path_parts):
    repo = (repo_id or "").strip("/")
    parts = [part.strip("/\\") for part in path_parts if part]
    path = posixpath.join(*parts) if parts else ""
    if not path:
        return f"https://huggingface.co/{repo}/resolve/main"
    return f"https://huggingface.co/{repo}/resolve/main/{path}"