jyh-zero / app.py
hiascend's picture
Update app.py
6e4178b verified
raw
history blame
424 Bytes
import gradio as gr
import spaces
import torch
zero = torch.Tensor([0]).cuda()
print('zero device: ' + str(zero.device))
one = torch.ones(2, 2, device='cuda')
print('one device: ' + str(one.device))
@spaces.GPU
def greet(n):
print('zero device' + str(zero.device))
print('one device' + str(one.device))
return f"Hello {zero + n} Tensor"
gr.Interface(fn=greet, inputs=gr.Number(), outputs=gr.Text()).launch()