mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-08-20 05:23:22 -07:00
correctly identify when not in colab
This commit is contained in:
parent
7326771c02
commit
8b793c1779
1 changed files with 14 additions and 4 deletions
|
@ -12,14 +12,24 @@ from tqdm import tqdm
|
||||||
|
|
||||||
from core import stdex
|
from core import stdex
|
||||||
|
|
||||||
|
is_colab = False
|
||||||
try:
|
try:
|
||||||
import IPython #if success we are in colab
|
import google.colab # if success we are in colab
|
||||||
|
is_colab = True
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
from IPython import get_ipython
|
||||||
|
shell = get_ipython().__class__.__name__
|
||||||
|
if shell == 'ZMQInteractiveShell': # if true we are in a jupyter notebook
|
||||||
|
is_colab = True
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if is_colab:
|
||||||
from IPython.display import display, clear_output
|
from IPython.display import display, clear_output
|
||||||
import PIL
|
import PIL
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
is_colab = True
|
|
||||||
except:
|
|
||||||
is_colab = False
|
|
||||||
|
|
||||||
yn_str = {True:'y',False:'n'}
|
yn_str = {True:'y',False:'n'}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue