Download zero.py from brenth82/diarizer: direct link, hf CLI and curl.
- Browser
- Download file 463 Bytes
-
https://huggingface.co/spaces/brenth82/diarizer/resolve/main/zero.py
- Command line
-
hf download hf://spaces/brenth82/diarizer/zero.py
-
curl -L -o zero.py https://huggingface.co/spaces/brenth82/diarizer/resolve/main/zero.py
463 Bytes
| import os | |
| zero_is_available = "SPACES_ZERO_GPU" in os.environ | |
| if zero_is_available: | |
| import spaces # type: ignore | |
| print("ZeroGPU is available") | |
| else: | |
| print("ZeroGPU is not available") | |
| # a decorator that applies the spaces.GPU decorator if zero is available | |
| def zero(duration=60): | |
| def wrapper(func): | |
| if zero_is_available: | |
| return spaces.GPU(func, duration=duration) | |
| else: | |
| return func | |
| return wrapper | |