File size: 858 Bytes
564b5ea
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""Bootstrap a Kaggle dataset copy of brain_server into /kaggle/working and print run guidance."""
from __future__ import annotations

import os
import shutil
from pathlib import Path


def main() -> None:
    source_root = Path(__file__).resolve().parent
    runtime_root = Path(os.getenv("KAPO_RUNTIME_ROOT") or "/kaggle/working/brain_server").resolve()

    if source_root != runtime_root:
        if runtime_root.exists():
            shutil.rmtree(runtime_root, ignore_errors=True)
        shutil.copytree(source_root, runtime_root)

    print(f"Bootstrapped brain_server to: {runtime_root}")
    print("Next steps:")
    print(f"  %cd {runtime_root}")
    print("  !pip install --default-timeout=1000 --no-cache-dir -r requirements.txt")
    print("  !python -m uvicorn api.main:app --host 0.0.0.0 --port 7860")


if __name__ == "__main__":
    main()