Download scripts/setup_env.py from sui234as/llm: direct link, hf CLI and curl.
- Browser
- Download file 1.18 kB
-
https://huggingface.co/spaces/sui234as/llm/resolve/main/scripts/setup_env.py
- Command line
-
hf download hf://spaces/sui234as/llm/scripts/setup_env.py
-
curl -L -o setup_env.py https://huggingface.co/spaces/sui234as/llm/resolve/main/scripts/setup_env.py
1.18 kB
| """ | |
| Environment Setup & Validation Script | |
| """ | |
| import secrets | |
| from pathlib import Path | |
| def setup(): | |
| root = Path(__file__).resolve().parents[1] | |
| env_file = root / ".env" | |
| env_example = root / ".env.example" | |
| print("=== Personal OS Setup ===") | |
| # Create .env if not exists | |
| if not env_file.exists() and env_example.exists(): | |
| print("[+] Creating .env from .env.example...") | |
| with open(env_example, encoding="utf-8") as src: | |
| content = src.read() | |
| secret_key = secrets.token_hex(32) | |
| content = content.replace( | |
| "generate_a_secure_random_string_here_minimum_32_chars", secret_key | |
| ) | |
| with open(env_file, "w", encoding="utf-8") as dst: | |
| dst.write(content) | |
| print("[+] .env generated with secure random SECRET_KEY.") | |
| else: | |
| print("[+] .env file already present.") | |
| # Create data directories | |
| data_dir = root / "data" / "artifacts" | |
| data_dir.mkdir(parents=True, exist_ok=True) | |
| print(f"[+] Artifact storage directory ready at: {data_dir}") | |
| print("\nSetup complete! You can now run:\n powershell scripts/dev.ps1") | |
| if __name__ == "__main__": | |
| setup() | |