llava-1.5-dlai / app.py
ybelkada's picture
Create app.py
71dee7d verified
raw
history blame
295 Bytes
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()