Spaces:
Running on Zero
Running on Zero
Download app.py from geeksiddhant/c8: direct link, hf CLI and curl.
- Browser
- Download file 307 Bytes
-
https://huggingface.co/spaces/geeksiddhant/c8/resolve/main/app.py
- Command line
-
hf download hf://spaces/geeksiddhant/c8/app.py
-
curl -L -o app.py https://huggingface.co/spaces/geeksiddhant/c8/resolve/main/app.py
307 Bytes
| import gradio as gr | |
| import spaces | |
| import torch | |
| zero = torch.Tensor([0]).cuda() | |
| print(zero.device) # <-- 'cpu' 🤔 | |
| def greet(n): | |
| print(zero.device) # <-- 'cuda:0' 🤗 | |
| return f"Hello {zero + n} Tensor" | |
| demo = gr.Interface(fn=greet, inputs=gr.Number(), outputs=gr.Text()) | |
| demo.launch() |