ddosxd's picture
Create app.py
7f6b5fc verified
raw
history blame
312 Bytes
import gradio as gr
import spaces
import torch
zero = torch.Tensor([0]).cuda()
print(zero.device) # <-- 'cpu' πŸ€”
@spaces.GPU
def chat(prompt):
print(zero.device) # <-- 'cuda:0' πŸ€—
return f"Hello {zero + n} Tensor"
gr.Interface(
fn=chat,
inputs=gr.Text(),
outputs=gr.Text()
).launch()