demo 1
Browse files
app.py
CHANGED
@@ -10,12 +10,12 @@ device = "cuda";
|
|
10 |
if not torch.cuda.is_available() and device == "cuda":
|
11 |
raise RuntimeError("CUDA device unavailable, please use Dockerfile.cpu instead.")
|
12 |
|
13 |
-
print("DEVICE: ", device);
|
14 |
-
|
15 |
RandomTensor = torch.randn(1, 2) # Example audio tensor
|
|
|
|
|
16 |
RandomTensor.to(device)
|
17 |
|
18 |
-
def sysinfo(
|
19 |
tensorExample = RandomTensor.to(device)
|
20 |
|
21 |
tocpu = tensorExample.cpu().squeeze().half().tolist()
|
@@ -30,12 +30,12 @@ def sysinfo(device):
|
|
30 |
@spaces.GPU
|
31 |
def gpu():
|
32 |
|
33 |
-
return sysinfo(
|
34 |
|
35 |
|
36 |
def nogpu():
|
37 |
|
38 |
-
return sysinfo(
|
39 |
|
40 |
|
41 |
|
|
|
10 |
if not torch.cuda.is_available() and device == "cuda":
|
11 |
raise RuntimeError("CUDA device unavailable, please use Dockerfile.cpu instead.")
|
12 |
|
|
|
|
|
13 |
RandomTensor = torch.randn(1, 2) # Example audio tensor
|
14 |
+
|
15 |
+
print("Putting Tensor in device ...", device);
|
16 |
RandomTensor.to(device)
|
17 |
|
18 |
+
def sysinfo():
|
19 |
tensorExample = RandomTensor.to(device)
|
20 |
|
21 |
tocpu = tensorExample.cpu().squeeze().half().tolist()
|
|
|
30 |
@spaces.GPU
|
31 |
def gpu():
|
32 |
|
33 |
+
return sysinfo();
|
34 |
|
35 |
|
36 |
def nogpu():
|
37 |
|
38 |
+
return sysinfo();
|
39 |
|
40 |
|
41 |
|