Spaces:
Runtime error
Runtime error
Download scripts/data_versioning.py from vriddhisaini/multi-agent-verifier: direct link, hf CLI and curl.
- Browser
- Download file 538 Bytes
-
https://huggingface.co/spaces/vriddhisaini/multi-agent-verifier/resolve/main/scripts/data_versioning.py
- Command line
-
hf download hf://spaces/vriddhisaini/multi-agent-verifier/scripts/data_versioning.py
-
curl -L -o data_versioning.py https://huggingface.co/spaces/vriddhisaini/multi-agent-verifier/resolve/main/scripts/data_versioning.py
538 Bytes
| import pickle, os, hashlib | |
| CACHE_DIR = "data/rag_stores.pkl" | |
| def get_rag_stores(build_func, force_rebuild=False): | |
| if not force_rebuild and os.path.exists(CACHE_DIR): | |
| with open(CACHE_DIR, "rb") as f: | |
| return pickle.load(f) | |
| stores = build_func() | |
| with open(CACHE_DIR, "wb") as f: | |
| pickle.dump(stores, f) | |
| return stores | |
| def get_data_version(): | |
| if os.path.exists(CACHE_DIR): | |
| with open(CACHE_DIR, "rb") as f: | |
| return hashlib.md5(f.read()).hexdigest()[:8] | |
| return "unversioned" | |