diff --git a/tensorboard/components/tf_tensorboard/tf-tensorboard.html b/tensorboard/components/tf_tensorboard/tf-tensorboard.html index 661cb456d6..37cdd46b7f 100644 --- a/tensorboard/components/tf_tensorboard/tf-tensorboard.html +++ b/tensorboard/components/tf_tensorboard/tf-tensorboard.html @@ -428,21 +428,6 @@

} } - - """.replace("%PORT%", "%d" % port).replace("%HEIGHT%", "%d" % height) - html = IPython.display.HTML(shell) + (async () => { + const url = await google.colab.kernel.proxyPort(%PORT%, {"cache": true}); + const iframe = document.createElement('iframe'); + iframe.src = url; + iframe.setAttribute('width', '100%'); + iframe.setAttribute('height', '%HEIGHT%'); + iframe.setAttribute('frameborder', 0); + document.body.appendChild(iframe); + })(); + """ + replacements = [ + ("%PORT%", "%d" % port), + ("%HEIGHT%", "%d" % height), + ] + for (k, v) in replacements: + shell = shell.replace(k, v) + script = IPython.display.Javascript(shell) + if display_handle: - display_handle.update(html) + display_handle.update(script) else: - IPython.display.display(html) + IPython.display.display(script) def _display_ipython(port, height, display_handle): diff --git a/tensorboard/plugins/profile/tf_profile_dashboard/tf-profile-dashboard.html b/tensorboard/plugins/profile/tf_profile_dashboard/tf-profile-dashboard.html index 781b03cc1e..b50835d0a6 100644 --- a/tensorboard/plugins/profile/tf_profile_dashboard/tf-profile-dashboard.html +++ b/tensorboard/plugins/profile/tf_profile_dashboard/tf-profile-dashboard.html @@ -49,21 +49,6 @@