Update app.py
Browse files
app.py
CHANGED
@@ -3,11 +3,15 @@ import spaces
|
|
3 |
import torch
|
4 |
|
5 |
zero = torch.Tensor([0]).cuda()
|
6 |
-
print(zero
|
|
|
|
|
|
|
7 |
|
8 |
@spaces.GPU
|
9 |
def greet(n):
|
10 |
-
print(zero.device)
|
|
|
11 |
return f"Hello {zero + n} Tensor"
|
12 |
|
13 |
gr.Interface(fn=greet, inputs=gr.Number(), outputs=gr.Text()).launch()
|
|
|
3 |
import torch
|
4 |
|
5 |
zero = torch.Tensor([0]).cuda()
|
6 |
+
print('zero device: ' + zero.device)
|
7 |
+
|
8 |
+
one = torch.ones(2, 2, device='cuda')
|
9 |
+
print('one device: ' + one.device)
|
10 |
|
11 |
@spaces.GPU
|
12 |
def greet(n):
|
13 |
+
print('zero device' + zero.device)
|
14 |
+
print('one device' + zero.device)
|
15 |
return f"Hello {zero + n} Tensor"
|
16 |
|
17 |
gr.Interface(fn=greet, inputs=gr.Number(), outputs=gr.Text()).launch()
|