Spaces:
Runtime error
Runtime error
Download models/utils.py from dangtiendatdat/real: direct link, hf CLI and curl.
- Browser
- Download file 272 Bytes
-
https://huggingface.co/spaces/dangtiendatdat/real/resolve/main/models/utils.py
- Command line
-
hf download hf://spaces/dangtiendatdat/real/models/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/dangtiendatdat/real/resolve/main/models/utils.py
272 Bytes
| import logging | |
| import torch | |
| def get_device_type() -> str: | |
| if torch.backends.mps.is_available(): | |
| return "mps" | |
| elif torch.cuda.is_available(): | |
| return "cuda" | |
| else: | |
| logging.warning("No GPU found, using CPU instead") | |
| return "cpu" | |