Download utils.py from ppaihack/Zamark: direct link, hf CLI and curl.
- Browser
- Download file 628 Bytes
-
https://huggingface.co/spaces/ppaihack/Zamark/resolve/main/utils.py
- Command line
-
hf download hf://spaces/ppaihack/Zamark/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/ppaihack/Zamark/resolve/main/utils.py
628 Bytes
| import os | |
| import shutil | |
| from pathlib import Path | |
| INPUT_BROWSER_LIMIT = 380 | |
| CURRENT_DIR = Path(__file__).parent | |
| DEPLOYMENT_DIR = CURRENT_DIR / "deployment_files" | |
| KEYS_DIR = DEPLOYMENT_DIR / ".fhe_keys" | |
| CLIENT_DIR = DEPLOYMENT_DIR / "client_dir" | |
| SERVER_DIR = DEPLOYMENT_DIR / "server_dir" | |
| ALL_DIRS = [KEYS_DIR, CLIENT_DIR, SERVER_DIR] | |
| def clean_directory() -> None: | |
| """ | |
| Clear direcgtories | |
| """ | |
| print("Cleaning...\n") | |
| for target_dir in ALL_DIRS: | |
| if os.path.exists(target_dir) and os.path.isdir(target_dir): | |
| shutil.rmtree(target_dir) | |
| target_dir.mkdir(exist_ok=True, parents=True) | |