File size: 460 Bytes
fecd672
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/size.ipynb.

# %% auto 0
__all__ = ['hfsize']

# %% ../nbs/size.ipynb 2
from fastcore.net import urljson, HTTPError

def hfsize(repo:str):
    "Returns the size in GB of a HuggingFace Dataset."
    url = f'https://huggingface.co/api/datasets/{repo}'
    try: resp = urljson(f'{url}/treesize/main')
    except HTTPError: return f'Did not find repo: {url}'
    gb = resp['size'] / 1e9
    return f'{gb:.2f} GB'