bugfix: fix issue 'cannot import name is_notebook' (#41)

This commit is contained in:
Fabio Monreal 2022-10-30 23:34:12 -03:00 committed by GitHub
parent 65cb7a2111
commit 64a3927762
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,6 +27,7 @@ from typing import Optional
from zipfile import ZipFile
import cv2
import IPython
import numpy as np
import pandas as pd
import pkg_resources as pkg
@ -137,6 +138,11 @@ def user_config_dir(dir='Ultralytics', env_var='YOLOV5_CONFIG_DIR'):
path.mkdir(exist_ok=True) # make if required
return path
def is_notebook():
# Is environment a Jupyter notebook? Verified on Colab, Jupyterlab, Kaggle, Paperspace
ipython_type = str(type(IPython.get_ipython()))
return 'colab' in ipython_type or 'zmqshell' in ipython_type
CONFIG_DIR = user_config_dir() # Ultralytics settings dir