File size: 420 Bytes
5adb527
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import spaces
import gradio as gr
import torch


@spaces.GPU
def gpu_hello():
    return f"Hello from ZeroGPU. CUDA visible: {torch.cuda.is_available()}, device count: {torch.cuda.device_count()}"


with gr.Blocks(title="ZeroGPU dev-mode test") as demo:
    gr.Markdown("# ZeroGPU dev-mode test")
    btn = gr.Button("Ping GPU")
    out = gr.Textbox(label="Result")
    btn.click(gpu_hello, outputs=out)


demo.launch()