File size: 318 Bytes
6d068ed
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import platform
import GPUtil
from dotenv import load_dotenv
load_dotenv()

def detect_runtime_environment():
    os_type = platform.system().lower()
    gpus = GPUtil.getGPUs()
    if gpus:
        return "gpu"
    elif os_type in ["darwin", "linux"]:
        return "cpu-local"
    else:
        return "cloud-only"