IlyasMoutawwakil HF staff commited on
Commit
77d2cc4
1 Parent(s): 7bb9bae
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -2,7 +2,15 @@ import os
2
  import subprocess
3
  import importlib.util
4
 
5
- NVIDIA_AVAILABLE = subprocess.check_output("nvidia-smi").decode("utf-8").strip() != ""
 
 
 
 
 
 
 
 
6
 
7
  if NVIDIA_AVAILABLE:
8
  DEVICES = ["cpu", "cuda"]
 
2
  import subprocess
3
  import importlib.util
4
 
5
+ NVIDIA_AVAILABLE = (
6
+ subprocess.run(
7
+ "nvidia-smi",
8
+ shell=True,
9
+ stdout=subprocess.DEVNULL,
10
+ stderr=subprocess.DEVNULL,
11
+ ).returncode
12
+ == 0
13
+ )
14
 
15
  if NVIDIA_AVAILABLE:
16
  DEVICES = ["cpu", "cuda"]