Allowed to return the image as a Jupyter Image only if the extension is not pdf
keras/utils/vis_utils.py
@@ -245,6 +245,7 @@ def plot_model(model,
extension = extension[1:]
dot.write(to_file, format=extension)
# Return the image as a Jupyter Image object, to be displayed in-line.
+ if extension != 'pdf':
try:
from IPython import display
return display.Image(filename=to_file)
