EDEN-Core-Scripts / eden_check_hf.py
Shanmuk4622's picture
Upload eden_check_hf.py with huggingface_hub
c330d97 verified
from huggingface_hub import HfApi, list_repo_files
import os
TOKEN = os.environ.get("HF_TOKEN", "")
api = HfApi(token=TOKEN)
repos = sorted(api.list_models(author="Shanmuk4622"), key=lambda x: x.id)
print(f"Total repos on HF: {len(repos)}\n")
missing_readme = []
missing_weights = []
for r in repos:
files = list(list_repo_files(r.id, token=TOKEN))
has_readme = "README.md" in files
has_weights = any(f.endswith(".pth") for f in files)
has_csv = any(f.endswith(".csv") for f in files)
parts = []
if has_readme: parts.append("README")
if has_weights: parts.append("weights")
if has_csv: parts.append("CSV")
tag = "OK" if (has_readme and has_weights) else "!!"
name = r.id.replace("Shanmuk4622/", "")
print(f" [{tag}] {name:<45} [{' + '.join(parts)}]")
if not has_readme: missing_readme.append(name)
if not has_weights: missing_weights.append(name)
print()
print(f"Missing README : {missing_readme or 'None'}")
print(f"Missing weights : {missing_weights or 'None'}")