Datasets:
Download patch_cache_ver.py from bep40/grob-products-updated: direct link, hf CLI and curl.
- Browser
- Download file 964 Bytes
-
https://huggingface.co/datasets/bep40/grob-products-updated/resolve/main/patch_cache_ver.py
- Command line
-
hf download hf://datasets/bep40/grob-products-updated/patch_cache_ver.py
-
curl -L -o patch_cache_ver.py https://huggingface.co/datasets/bep40/grob-products-updated/resolve/main/patch_cache_ver.py
964 Bytes
| import requests, os, io | |
| H = "https://huggingface.co" | |
| from huggingface_hub import HfApi | |
| tok = os.environ["HF_TOKEN"] | |
| api = HfApi(token=tok, endpoint=H) | |
| # fetch current space file | |
| r = requests.get(H + "/spaces/bep40/vai-avatar2/resolve/main/src/catalogue-ai.js", timeout=120) | |
| r.raise_for_status() | |
| src = r.content.decode("utf-8") | |
| print("len:", len(src), "CACHE_VER v12 present:", 'CACHE_VER = "v12"' in src) | |
| new = src.replace('var CACHE_VER = "v12";', 'var CACHE_VER = "v13";') | |
| print("v12->v13 replaced:", new != src) | |
| info = api.upload_file(path_or_fileobj=io.BytesIO(new.encode("utf-8")), | |
| path_in_repo="src/catalogue-ai.js", | |
| repo_id="bep40/vai-avatar2", repo_type="space", | |
| commit_message="CACHE_VER v12->v13: load Imudex v2.2 photo crops + per-SKU specs") | |
| print("uploaded:", info.commit_url) | |
| # verify | |
| r2 = requests.get(H + "/spaces/bep40/vai-avatar2/resolve/main/src/catalogue-ai.js", timeout=120) | |
| print("verify v13:", 'CACHE_VER = "v13"' in r2.text) | |