Merge pull request #37213 from jaketae:embed-pdf

PiperOrigin-RevId: 313434163
Change-Id: Ib895aea697e95809855b63742923088556f8f2d0
This commit is contained in:
TensorFlower Gardener 2020-05-27 12:04:05 -07:00
commit 66a9ffbc72

View File

@ -317,8 +317,9 @@ def plot_model(model,
# Return the image as a Jupyter Image object, to be displayed in-line.
# Note that we cannot easily detect whether the code is running in a
# notebook, and thus we always return the Image if Jupyter is available.
try:
from IPython import display
return display.Image(filename=to_file)
except ImportError:
pass
if extension != 'pdf':
try:
from IPython import display
return display.Image(filename=to_file)
except ImportError:
pass