zerogpu-test / app.py
JasonJwba
Update app.py
5560083 verified
raw
history blame contribute delete
321 Bytes
import gradio as gr
import spaces
import torch
@spaces.GPU
def greet(name):
if torch.cuda.is_available():
tensor = torch.Tensor([0]).cuda()
else:
tensor = torch.Tensor([0])
return f"Tensor: {tensor}, Name: {name}"
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()