Update app.py
Browse files
app.py
CHANGED
@@ -6,11 +6,11 @@ import numpy as np
|
|
6 |
import gradio as gr
|
7 |
|
8 |
def _grab_best_device(use_gpu=True):
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
device = 0 if torch.cuda.is_available() else -1
|
14 |
|
15 |
return device
|
16 |
|
|
|
6 |
import gradio as gr
|
7 |
|
8 |
def _grab_best_device(use_gpu=True):
|
9 |
+
if torch.cuda.device_count() > 0 and use_gpu:
|
10 |
+
device = 0 #"cuda"
|
11 |
+
else:
|
12 |
+
device = -1 #"cpu"
|
13 |
+
#device = 0 if torch.cuda.is_available() else -1
|
14 |
|
15 |
return device
|
16 |
|