Spaces:
Sleeping
Sleeping
File size: 313 Bytes
e11fc76 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
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 n
counter = gr.State(value=0)
gr.Interface(
fn=greet,
inputs=[counter],
outputs=[counter],
).launch()
|