Commit
•
987c090
1
Parent(s):
f07e104
Update vi/script.js
Browse files- vi/script.js +7 -16
vi/script.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
var log = console.log;
|
2 |
-
var
|
3 |
-
var
|
4 |
var RNN_SIZE = 400;
|
5 |
var VOCAB_SIZE = 165;
|
6 |
var NUM_ATT_HEADS=10;
|
7 |
var NUM_GMM_HEADS=20;
|
8 |
var cur_run = 0;
|
9 |
-
var scale_factor =
|
10 |
|
11 |
var randn = function() {
|
12 |
// Standard Normal random variable using Box-Muller transform.
|
@@ -67,11 +67,9 @@ var generate = function() {
|
|
67 |
var dojob = function(run_id) {
|
68 |
var text = document.getElementById("user-input").value;
|
69 |
if (text.length == 0) {
|
70 |
-
text = "
|
71 |
}
|
72 |
|
73 |
-
|
74 |
-
log(text);
|
75 |
original_text = text;
|
76 |
text = '' + text + ' ';
|
77 |
|
@@ -87,7 +85,6 @@ var dojob = function(run_id) {
|
|
87 |
var writer_embed = WEIGHTS['rnn/~/embed__embeddings'];
|
88 |
var e = document.getElementById("writers");
|
89 |
var wid = parseInt(e.value);
|
90 |
-
log(wid);
|
91 |
|
92 |
wid = tf.tensor1d([wid], 'int32');
|
93 |
wid = writer_embed.gather(wid);
|
@@ -133,8 +130,8 @@ var dojob = function(run_id) {
|
|
133 |
var bias = parseInt(document.getElementById("bias").value) / 100 * 3;
|
134 |
|
135 |
|
136 |
-
var cur_x =
|
137 |
-
var cur_y =
|
138 |
var path = [];
|
139 |
var dx = 0.;
|
140 |
var dy = 0;
|
@@ -235,12 +232,6 @@ var dojob = function(run_id) {
|
|
235 |
}
|
236 |
|
237 |
|
238 |
-
window.
|
239 |
-
//Setting up canvas
|
240 |
-
canvas = document.getElementById("hw-canvas");
|
241 |
-
ctx = canvas.getContext("2d");
|
242 |
scale_factor = window.innerWidth / 1600;
|
243 |
-
ctx.canvas.width = window.innerWidth - 50;
|
244 |
-
ctx.canvas.height = window.innerHeight - 50;
|
245 |
-
|
246 |
}
|
|
|
1 |
var log = console.log;
|
2 |
+
var canvas = document.getElementById("hw-canvas");
|
3 |
+
var ctx = canvas.getContext("2d");
|
4 |
var RNN_SIZE = 400;
|
5 |
var VOCAB_SIZE = 165;
|
6 |
var NUM_ATT_HEADS=10;
|
7 |
var NUM_GMM_HEADS=20;
|
8 |
var cur_run = 0;
|
9 |
+
var scale_factor = 0.6;
|
10 |
|
11 |
var randn = function() {
|
12 |
// Standard Normal random variable using Box-Muller transform.
|
|
|
67 |
var dojob = function(run_id) {
|
68 |
var text = document.getElementById("user-input").value;
|
69 |
if (text.length == 0) {
|
70 |
+
text = "Chuyển đổi text thành chữ viết tay";
|
71 |
}
|
72 |
|
|
|
|
|
73 |
original_text = text;
|
74 |
text = '' + text + ' ';
|
75 |
|
|
|
85 |
var writer_embed = WEIGHTS['rnn/~/embed__embeddings'];
|
86 |
var e = document.getElementById("writers");
|
87 |
var wid = parseInt(e.value);
|
|
|
88 |
|
89 |
wid = tf.tensor1d([wid], 'int32');
|
90 |
wid = writer_embed.gather(wid);
|
|
|
130 |
var bias = parseInt(document.getElementById("bias").value) / 100 * 3;
|
131 |
|
132 |
|
133 |
+
var cur_x = 10;
|
134 |
+
var cur_y = canvas.height/2;
|
135 |
var path = [];
|
136 |
var dx = 0.;
|
137 |
var dy = 0;
|
|
|
232 |
}
|
233 |
|
234 |
|
235 |
+
window.on = function(e) {
|
|
|
|
|
|
|
236 |
scale_factor = window.innerWidth / 1600;
|
|
|
|
|
|
|
237 |
}
|