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()