File size: 1,142 Bytes
462cdb6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ca71db7
462cdb6
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import json
import os

from huggingface_hub import HfApi, login


def check_dataset_updates(dataset_id):
    api = HfApi()
    dataset_info = api.dataset_info(dataset_id)
    last_modified = dataset_info.lastModified.isoformat()
    current_sha = dataset_info.sha

    cache_dir = "dashboard_data"

    cache_file = os.path.join(cache_dir, "version.json")

    if os.path.exists(cache_file):
        with open(cache_file, "r") as f:
            cached_data = json.load(f)
            if cached_data.get("sha") == current_sha:
                with open(os.environ["GITHUB_OUTPUT"], "a") as fh:
                    print(f"has_updates=false", file=fh)
                return

    with open(cache_file, "w") as f:
        json.dump(
            {
                "last_modified": last_modified,
                "sha": current_sha,
                "releases": ["dd2eb73"],
            },
            f,
        )

    with open(os.environ["GITHUB_OUTPUT"], "a") as fh:
        print(f"has_updates=true", file=fh)


if __name__ == "__main__":
    login(token=os.environ["HF_TOKEN"])
    check_dataset_updates("argmaxinc/whisperkit-evals-dataset")