Last active
December 6, 2020 10:34
-
-
Save mindryu/5a8e7914d0b2cdba90a52b087599a733 to your computer and use it in GitHub Desktop.
Check Local or Colab
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_local(): | |
""" | |
로컬 실행 여부 | |
""" | |
server = next(notebookapp.list_running_servers()) | |
return True if server['hostname'] == 'localhost' else False | |
def is_colab(): | |
""" | |
코랩 실행여부 | |
""" | |
try: | |
from google.colab import drive | |
return True | |
except: | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment