Spaces:
Running
Running
File size: 349 Bytes
9c6a2da 20528a2 9c6a2da 20528a2 9c6a2da 20528a2 9c6a2da 20528a2 9c6a2da 20528a2 35c77e1 9c6a2da 20528a2 |
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 |
"""
#!/bin/bash
CUDA_ENABLED=${CUDA_ENABLED:-true}
DEVICE=""
if [ "${CUDA_ENABLED}" != "true" ]; then
DEVICE="--device cpu"
fi
exec python tools/webui.py ${DEVICE}
"""
import os
import torch
if torch.cuda.is_available():
DEVICE = "cuda"
else:
DEVICE = "cpu"
DEVICE = f"--device {DEVICE}"
os.system(f"python tools/webui.py {DEVICE}") |