Spaces:
Running on Zero
Running on Zero
Download app.py from codestellar/agentic-ai: direct link, hf CLI and curl.
- Browser
- Download file 318 Bytes
-
https://huggingface.co/spaces/codestellar/agentic-ai/resolve/main/app.py
- Command line
-
hf download hf://spaces/codestellar/agentic-ai/app.py
-
curl -L -o app.py https://huggingface.co/spaces/codestellar/agentic-ai/resolve/main/app.py
318 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(share=True) | |