Spaces:
Sleeping
Sleeping
Download app/utils/hash.py from thabsheeeeeer/DocBrain-API: direct link, hf CLI and curl.
- Browser
- Download file 264 Bytes
-
https://huggingface.co/spaces/thabsheeeeeer/DocBrain-API/resolve/main/app/utils/hash.py
- Command line
-
hf download hf://spaces/thabsheeeeeer/DocBrain-API/app/utils/hash.py
-
curl -L -o hash.py https://huggingface.co/spaces/thabsheeeeeer/DocBrain-API/resolve/main/app/utils/hash.py
264 Bytes
| import hashlib | |
| def generate_file_hash(file_path: str) -> str: | |
| hash_sha256 = hashlib.sha256() | |
| with open(file_path, "rb") as f: | |
| for chunk in iter(lambda: f.read(4096), b""): | |
| hash_sha256.update(chunk) | |
| return hash_sha256.hexdigest() |