Spaces:
Paused
Paused
Download trackio/launch_utils.py from trackio-tests/test_656: direct link, hf CLI and curl.
- Browser
- Download file 761 Bytes
-
https://huggingface.co/spaces/trackio-tests/test_656/resolve/main/trackio/launch_utils.py
- Command line
-
hf download hf://spaces/trackio-tests/test_656/trackio/launch_utils.py
-
curl -L -o launch_utils.py https://huggingface.co/spaces/trackio-tests/test_656/resolve/main/trackio/launch_utils.py
761 Bytes
| import os | |
| def colab_check() -> bool: | |
| is_colab = False | |
| try: | |
| from IPython.core.getipython import get_ipython # noqa: PLC0415 | |
| from_ipynb = get_ipython() | |
| if "google.colab" in str(from_ipynb): | |
| is_colab = True | |
| except (ImportError, NameError): | |
| pass | |
| return is_colab | |
| def is_hosted_notebook() -> bool: | |
| return bool( | |
| os.environ.get("KAGGLE_KERNEL_RUN_TYPE") | |
| or os.path.exists("/home/ec2-user/SageMaker") | |
| ) | |
| def ipython_check() -> bool: | |
| is_ipython = False | |
| try: | |
| from IPython.core.getipython import get_ipython # noqa: PLC0415 | |
| if get_ipython() is not None: | |
| is_ipython = True | |
| except (ImportError, NameError): | |
| pass | |
| return is_ipython | |