EvanTHU commited on
Commit
bc6c851
β€’
1 Parent(s): 4f39643
Files changed (1) hide show
  1. app.py +2 -0
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