Spaces:
Running
on
Zero
Running
on
Zero
EvanTHU
commited on
Commit
β’
bc6c851
1
Parent(s):
4f39643
add app
Browse files
app.py
CHANGED
@@ -1,12 +1,14 @@
|
|
1 |
import gradio as gr
|
2 |
import spaces
|
3 |
import torch
|
|
|
4 |
|
5 |
zero = torch.Tensor([0]).cuda()
|
6 |
print(zero.device) # <-- 'cpu' π€
|
7 |
|
8 |
@spaces.GPU
|
9 |
def greet(n):
|
|
|
10 |
print(zero.device) # <-- 'cuda:0' π€
|
11 |
return f"Hello {zero + n} Tensor"
|
12 |
|
|
|
1 |
import gradio as gr
|
2 |
import spaces
|
3 |
import torch
|
4 |
+
import os
|
5 |
|
6 |
zero = torch.Tensor([0]).cuda()
|
7 |
print(zero.device) # <-- 'cpu' π€
|
8 |
|
9 |
@spaces.GPU
|
10 |
def greet(n):
|
11 |
+
os.system("nvidia-smi")
|
12 |
print(zero.device) # <-- 'cuda:0' π€
|
13 |
return f"Hello {zero + n} Tensor"
|
14 |
|