From 64a39277622c64b9664690dfc46bfad56e18ca70 Mon Sep 17 00:00:00 2001 From: Fabio Monreal Date: Sun, 30 Oct 2022 23:34:12 -0300 Subject: [PATCH] bugfix: fix issue 'cannot import name is_notebook' (#41) --- utils/general.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/utils/general.py b/utils/general.py index de7871c..c451914 100644 --- a/utils/general.py +++ b/utils/general.py @@ -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