Download libs/utils.py from anpigon/law-bot: direct link, hf CLI and curl.
- Browser
- Download file 198 Bytes
-
https://huggingface.co/spaces/anpigon/law-bot/resolve/main/libs/utils.py
- Command line
-
hf download hf://spaces/anpigon/law-bot/libs/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/anpigon/law-bot/resolve/main/libs/utils.py
198 Bytes
| # utils.py | |
| import torch | |
| def get_device(): | |
| if torch.cuda.is_available(): | |
| return "cuda:0" | |
| elif torch.backends.mps.is_available(): | |
| return "mps" | |
| else: | |
| return "cpu" | |