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")