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 @@
}
}
-
-
-
Dynamic plugin isn’t supported in Colab yet.
-
- Please see
- GitHub issue #1913
- for more information.
-
-
-
- """.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 @@
-
-
-
Profiling isn’t supported in Colab yet.
-
- Please see
- GitHub issue #1913
- for more information.
-
-
-
Close now!No profile data was found.
* @enum {string}
*/
const TopLevelState = {
- /**
- * Indicates that we are in a Colab notebook environment. The
- * profile dashboard does not work well in Colab; the trace viewer
- * does not work at all. If in Colab, we'll show only an explanatory
- * message.
- */
- IN_COLAB: 'IN_COLAB',
/**
* Indicates that there are no runs with profile data.
*/
@@ -514,16 +492,10 @@ No profile data was found.
type: Array,
observer: '_activeHostsChanged',
},
- _inColab: {
- type: Boolean,
- value: () => !!(window.TENSORBOARD_ENV || {}).IN_COLAB,
- readOnly: true,
- },
/** @type {TopLevelState} */
_topLevelState: {
type: String,
- computed:
- '_computeTopLevelState(_inColab, _dataNotFound, progress)',
+ computed: '_computeTopLevelState(_dataNotFound, progress)',
readOnly: true,
},
/**
@@ -950,8 +922,7 @@ No profile data was found.
// Otherwise, remove the seperator, e.g. "host1_" => "host1".
return host.slice(0, -1);
},
- _computeTopLevelState: function(inColab, dataNotFound, progress) {
- if (inColab) return 'IN_COLAB';
+ _computeTopLevelState: function(dataNotFound, progress) {
if (dataNotFound) return 'DATA_NOT_FOUND';
if (!progress || progress.value < 100) return 'LOADING';
return 'ACTIVE';