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