Spaces:
Paused
Paused
File size: 296 Bytes
f6475e2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
import gradio as gr
import spaces
import torch
zero = torch.Tensor([0]).cuda()
print(zero.device) # <-- 'cpu' π€
@spaces.GPU
def greet(n):
print(zero.device) # <-- 'cuda:0' π€
return f"Hello {zero + n} Tensor"
gr.Interface(fn=greet, inputs=gr.Number(), outputs=gr.Text()).launch()
|