Skip to content

Commit 6dca9c1

Browse files
committed
changed-ui
1 parent 55283d2 commit 6dca9c1

File tree

4 files changed

+202
-97
lines changed

4 files changed

+202
-97
lines changed

neural_style_transfer/dist/bundle.js

+45-44
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,15 @@ var Main = function () {
206206
if (i < n) {
207207
var j = i + 1;
208208
var progressBar = document.getElementById("Bar");
209+
var percent = document.getElementById("percent");
209210
document.getElementById("counter").innerHTML = "Epochs: " + j * 40;
210211
var width = 100 * (j / n);
211212
if (width >= 102) {
212213
progressBar.style.width = 0;
214+
percent.innerHTML = "0%";
213215
} else {
214216
progressBar.style.width = width + "%";
217+
percent.innerHTML = width + "%";
215218
}
216219
_this2.gradualStyler(n, i + 1);
217220
} else {
@@ -240,6 +243,7 @@ var Main = function () {
240243
this.styleImg.onerror = function () {
241244
alert("Error loading " + _this3.styleImg.src + ".");
242245
};
246+
this.dispImg = document.getElementById('img_lower');
243247
this.stylized = document.getElementById('stylized');
244248

245249
this.styleRatio = 1.0;
@@ -251,14 +255,18 @@ var Main = function () {
251255
// Initialize buttons
252256
this.styleButton = document.getElementById('style-button');
253257
this.styleButton.onclick = function () {
258+
var cover = document.getElementsByClassName('img-container')[0];
259+
cover.style.display = "none";
254260
_this3.disableStylizeButtons();
255261
_this3.gradualStyler(25, 0);
262+
var results = document.getElementById('result');
263+
results.style.display = "block";
256264
};
257265

258266
// Initialize selectors
259267
this.contentSelect = document.getElementById('content-select');
260268
this.contentSelect.onchange = function (net) {
261-
return _this3.image_select(_this3.contentImg, net.target.value);
269+
_this3.image_select(_this3.contentImg, net.target.value), _this3.image_select(_this3.dispImg, net.target.value);
262270
};
263271
this.contentSelect.onclick = function () {
264272
return _this3.contentSelect.value = '';
@@ -603,10 +611,20 @@ var Main = function () {
603611
window.onload = function () {
604612
var dwn = document.getElementById('btndownload'),
605613
canvas = document.getElementById('stylized'),
606-
context = canvas.getContext('2d');
614+
context = canvas.getContext('2d'),
615+
show = document.getElementById('btnshow');
607616
dwn.onclick = function () {
608617
download(canvas, 'design.png');
609618
};
619+
show.onclick = function () {
620+
var link = document.getElementById('stylized').toDataURL("image/png;base64");
621+
var box = document.getElementById('img_over');
622+
var cover = document.getElementsByClassName('img-container')[0];
623+
box.src = link;
624+
cover.style.display = "block";
625+
new BeerSlider(document.getElementById('slider'));
626+
console.log("done");
627+
};
610628
};
611629

612630
function download(canvas, filename) {
@@ -63856,10 +63874,6 @@ function fromByteArray (uint8) {
6385663874

6385763875
var base64 = require('base64-js')
6385863876
var ieee754 = require('ieee754')
63859-
var customInspectSymbol =
63860-
(typeof Symbol === 'function' && typeof Symbol.for === 'function')
63861-
? Symbol.for('nodejs.util.inspect.custom')
63862-
: null
6386363877

6386463878
exports.Buffer = Buffer
6386563879
exports.SlowBuffer = SlowBuffer
@@ -63896,9 +63910,7 @@ function typedArraySupport () {
6389663910
// Can typed array instances can be augmented?
6389763911
try {
6389863912
var arr = new Uint8Array(1)
63899-
var proto = { foo: function () { return 42 } }
63900-
Object.setPrototypeOf(proto, Uint8Array.prototype)
63901-
Object.setPrototypeOf(arr, proto)
63913+
arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function () { return 42 } }
6390263914
return arr.foo() === 42
6390363915
} catch (e) {
6390463916
return false
@@ -63927,7 +63939,7 @@ function createBuffer (length) {
6392763939
}
6392863940
// Return an augmented `Uint8Array` instance
6392963941
var buf = new Uint8Array(length)
63930-
Object.setPrototypeOf(buf, Buffer.prototype)
63942+
buf.__proto__ = Buffer.prototype
6393163943
return buf
6393263944
}
6393363945

@@ -63954,6 +63966,17 @@ function Buffer (arg, encodingOrOffset, length) {
6395463966
return from(arg, encodingOrOffset, length)
6395563967
}
6395663968

63969+
// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
63970+
if (typeof Symbol !== 'undefined' && Symbol.species != null &&
63971+
Buffer[Symbol.species] === Buffer) {
63972+
Object.defineProperty(Buffer, Symbol.species, {
63973+
value: null,
63974+
configurable: true,
63975+
enumerable: false,
63976+
writable: false
63977+
})
63978+
}
63979+
6395763980
Buffer.poolSize = 8192 // not used by this implementation
6395863981

6395963982
function from (value, encodingOrOffset, length) {
@@ -63966,7 +63989,7 @@ function from (value, encodingOrOffset, length) {
6396663989
}
6396763990

6396863991
if (value == null) {
63969-
throw new TypeError(
63992+
throw TypeError(
6397063993
'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
6397163994
'or Array-like Object. Received type ' + (typeof value)
6397263995
)
@@ -63977,12 +64000,6 @@ function from (value, encodingOrOffset, length) {
6397764000
return fromArrayBuffer(value, encodingOrOffset, length)
6397864001
}
6397964002

63980-
if (typeof SharedArrayBuffer !== 'undefined' &&
63981-
(isInstance(value, SharedArrayBuffer) ||
63982-
(value && isInstance(value.buffer, SharedArrayBuffer)))) {
63983-
return fromArrayBuffer(value, encodingOrOffset, length)
63984-
}
63985-
6398664003
if (typeof value === 'number') {
6398764004
throw new TypeError(
6398864005
'The "value" argument must not be of type number. Received type number'
@@ -64024,8 +64041,8 @@ Buffer.from = function (value, encodingOrOffset, length) {
6402464041

6402564042
// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
6402664043
// https://github.com/feross/buffer/pull/148
64027-
Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)
64028-
Object.setPrototypeOf(Buffer, Uint8Array)
64044+
Buffer.prototype.__proto__ = Uint8Array.prototype
64045+
Buffer.__proto__ = Uint8Array
6402964046

6403064047
function assertSize (size) {
6403164048
if (typeof size !== 'number') {
@@ -64129,8 +64146,7 @@ function fromArrayBuffer (array, byteOffset, length) {
6412964146
}
6413064147

6413164148
// Return an augmented `Uint8Array` instance
64132-
Object.setPrototypeOf(buf, Buffer.prototype)
64133-
64149+
buf.__proto__ = Buffer.prototype
6413464150
return buf
6413564151
}
6413664152

@@ -64452,9 +64468,6 @@ Buffer.prototype.inspect = function inspect () {
6445264468
if (this.length > max) str += ' ... '
6445364469
return '<Buffer ' + str + '>'
6445464470
}
64455-
if (customInspectSymbol) {
64456-
Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect
64457-
}
6445864471

6445964472
Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
6446064473
if (isInstance(target, Uint8Array)) {
@@ -64580,7 +64593,7 @@ function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
6458064593
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
6458164594
}
6458264595
}
64583-
return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)
64596+
return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
6458464597
}
6458564598

6458664599
throw new TypeError('val must be string, number or Buffer')
@@ -64909,7 +64922,7 @@ function hexSlice (buf, start, end) {
6490964922

6491064923
var out = ''
6491164924
for (var i = start; i < end; ++i) {
64912-
out += hexSliceLookupTable[buf[i]]
64925+
out += toHex(buf[i])
6491364926
}
6491464927
return out
6491564928
}
@@ -64946,8 +64959,7 @@ Buffer.prototype.slice = function slice (start, end) {
6494664959

6494764960
var newBuf = this.subarray(start, end)
6494864961
// Return an augmented `Uint8Array` instance
64949-
Object.setPrototypeOf(newBuf, Buffer.prototype)
64950-
64962+
newBuf.__proto__ = Buffer.prototype
6495164963
return newBuf
6495264964
}
6495364965

@@ -65436,8 +65448,6 @@ Buffer.prototype.fill = function fill (val, start, end, encoding) {
6543665448
}
6543765449
} else if (typeof val === 'number') {
6543865450
val = val & 255
65439-
} else if (typeof val === 'boolean') {
65440-
val = Number(val)
6544165451
}
6544265452

6544365453
// Invalid ranges are not set to a default, so can range check early.
@@ -65495,6 +65505,11 @@ function base64clean (str) {
6549565505
return str
6549665506
}
6549765507

65508+
function toHex (n) {
65509+
if (n < 16) return '0' + n.toString(16)
65510+
return n.toString(16)
65511+
}
65512+
6549865513
function utf8ToBytes (string, units) {
6549965514
units = units || Infinity
6550065515
var codePoint
@@ -65625,20 +65640,6 @@ function numberIsNaN (obj) {
6562565640
return obj !== obj // eslint-disable-line no-self-compare
6562665641
}
6562765642

65628-
// Create lookup table for `toString('hex')`
65629-
// See: https://github.com/feross/buffer/issues/219
65630-
var hexSliceLookupTable = (function () {
65631-
var alphabet = '0123456789abcdef'
65632-
var table = new Array(256)
65633-
for (var i = 0; i < 16; ++i) {
65634-
var i16 = i * 16
65635-
for (var j = 0; j < 16; ++j) {
65636-
table[i16 + j] = alphabet[i] + alphabet[j]
65637-
}
65638-
}
65639-
return table
65640-
})()
65641-
6564265643
}).call(this,require("buffer").Buffer)
6564365644
},{"base64-js":302,"buffer":304,"ieee754":629}],305:[function(require,module,exports){
6564465645
require('../../modules/core.regexp.escape');

neural_style_transfer/images/back.jpg

366 KB
Loading

0 commit comments

Comments
 (0)