File tree Expand file tree Collapse file tree 6 files changed +213
-105
lines changed
tensorflow_model_analysis Expand file tree Collapse file tree 6 files changed +213
-105
lines changed Original file line number Diff line number Diff line change 5454 * metrics_plots_and_validations_writer was failing while writing cross
5555 slice comparison results to metrics file.
5656 * Fairness widget view was not compatible with cross slicing key type.
57+ * Fix support for exporting the UI from a notebook to a standalone HTML page.
5758* Depends on ` absl-py>=0.9,<0.13 ` .
5859* Depends on ` tensorflow-metadata>=0.29.0,<0.30.0 ` .
5960* Depends on ` tfx-bsl>=0.29.0,<0.30.0 ` .
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ module.exports = {
2020 id : 'tensorflow_model_analysis' ,
2121 requires : [ base . IJupyterWidgetRegistry ] ,
2222 activate : function ( app , widgets ) {
23+ // Set a global variable to mark plugin as being run within Jupyter Lab.
24+ window [ 'isJupyterLab' ] = true ;
2325 widgets . registerWidget ( {
2426 name : 'tensorflow_model_analysis' ,
2527 version : plugin . version ,
Original file line number Diff line number Diff line change @@ -21,9 +21,23 @@ const version = require('../package.json').version;
2121 * Helper method to load the vulcanized templates.
2222 */
2323function loadVulcanizedTemplate ( ) {
24- const templateLocation =
25- ( document . querySelector ( 'body' ) . getAttribute ( 'data-base-url' ) || '/' ) +
26- 'nbextensions/tensorflow_model_analysis/vulcanized_tfma.js' ;
24+ let templatePath ;
25+ const dataBaseUrl =
26+ document . querySelector ( 'body' ) . getAttribute ( 'data-base-url' ) ;
27+ // Jupyter Classic
28+ if ( dataBaseUrl ) {
29+ templatePath = dataBaseUrl + 'nbextensions/tensorflow_model_analysis/' ;
30+ }
31+ // Jupyter Lab
32+ else if ( window [ 'isJupyterLab' ] ) {
33+ templatePath = '/nbextensions/tensorflow_model_analysis/' ;
34+ }
35+ // Kubeflow
36+ else {
37+ templatePath = __webpack_public_path__ ;
38+ }
39+ // templatePath ends with a slash.
40+ const templateLocation = `${ templatePath } vulcanized_tfma.js` ;
2741
2842 // If the vulcanizes tempalets are not loaded yet, load it now.
2943 if ( ! document . querySelector ( 'script[src="' + templateLocation + '"]' ) ) {
Original file line number Diff line number Diff line change 1- /**
2- * Copyright 2018 Google LLC
3- *
4- * Licensed under the Apache License, Version 2.0 (the "License");
5- * you may not use this file except in compliance with the License.
6- * You may obtain a copy of the License at
7- *
8- * https://www.apache.org/licenses/LICENSE-2.0
9- *
10- * Unless required by applicable law or agreed to in writing, software
11- * distributed under the License is distributed on an "AS IS" BASIS,
12- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13- * See the License for the specific language governing permissions and
14- * limitations under the License.
15- */
161define ( function ( ) { return /******/ ( function ( modules ) { // webpackBootstrap
172/******/ // The module cache
183/******/ var installedModules = { } ;
@@ -105,7 +90,8 @@ if (window.require) {
10590 window . require . config ( {
10691 map : {
10792 '*' : {
108- 'tensorflow_model_analysis' : 'nbextensions/tensorflow_model_analysis/index' ,
93+ 'tensorflow_model_analysis' :
94+ 'nbextensions/tensorflow_model_analysis/index' ,
10995 }
11096 }
11197 } ) ;
@@ -118,4 +104,4 @@ module.exports = {
118104
119105
120106/***/ } )
121- /******/ ] ) } ) ; ;
107+ /******/ ] ) } ) ; ;
You can’t perform that action at this time.
0 commit comments