11
22
3- /**
4- * @license
5- * Copyright 2018 Google LLC. All Rights Reserved.
6- * Licensed under the Apache License, Version 2.0 (the "License");
7- * you may not use this file except in compliance with the License.
8- * You may obtain a copy of the License at
9- *
10- * http://www.apache.org/licenses/LICENSE-2.0
11- *
12- * Unless required by applicable law or agreed to in writing, software
13- * distributed under the License is distributed on an "AS IS" BASIS,
14- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15- * See the License for the specific language governing permissions and
16- * limitations under the License.
17- * =============================================================================
18- */
193import * as tf from '@tensorflow/tfjs' ;
204import * as tfvis from '@tensorflow/tfjs-vis' ;
215import Plotly from 'plotly.js-dist' ;
22-
23- import * as data from './data' ;
6+ import * as data from './data' ;
247
258
269
@@ -44,8 +27,19 @@ import Plotly from 'plotly.js-dist';
4427 var xte_a = Array ( ) ;
4528 var yte_a = Array ( ) ;
4629
47- document . getElementById ( 'show-nn-architecture' )
48- . addEventListener ( 'click' , async ( ) => {
30+
31+ var load = document . getElementById ( "loader" ) ;
32+ load . style . fontSize = "30px" ;
33+ load . style . color = "black" ;
34+ load . style . fontFamily = "monospace" ;
35+ load . style . backgroundColor = "greenyellow" ;
36+ var callback1 = function ( )
37+ {
38+ load . innerHTML = "Training......" ;
39+ }
40+
41+ var callback2 = function ( )
42+ {
4943 xl = [ ] ; yl = [ ] ;
5044 xtr_a = [ ] ; ytr_a = [ ] ;
5145 xte_a = [ ] ; yte_a = [ ] ;
@@ -176,7 +170,6 @@ for(var e=0;e<iter;e++)
176170 total_loss += value . arraySync ( ) ;
177171
178172
179-
180173
181174
182175 for ( var j = 0 ; j < layers ; j ++ )
@@ -576,6 +569,20 @@ tea.beginPath();
576569tea . font = "25px Arial" ;
577570tea . fillText ( "Test accuracy(30 egs) vs epoch => " , 5 , 20 ) ;
578571
579- } ) ;
572+
573+
574+ load . innerHTML = "Model Trained" + String . fromCharCode ( 0xD83D , 0xDE04 ) ;
575+
576+ }
577+
578+
579+ document . getElementById ( 'show-nn-architecture' )
580+ . addEventListener ( 'click' , show ) ;
581+
582+ function show ( )
583+ {
584+ setTimeout ( callback1 , 1000 ) ;
585+ setTimeout ( callback2 , 2000 ) ;
586+ }
580587
581588
0 commit comments