Skip to content

Instantly share code, notes, and snippets.

@kidapu
Last active April 17, 2016 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kidapu/d9b6d469bacbcd3fad15778149d72c12 to your computer and use it in GitHub Desktop.
Save kidapu/d9b6d469bacbcd3fad15778149d72c12 to your computer and use it in GitHub Desktop.
neural-style-test.js
var _child = require('child_process');
// convert
init();
function init()
{
// safety success
var args = [
"neural_style.lua",
"-style_image" , "outputs/kida/jiburi.jpg",
"-content_image" , "outputs/kida/kida.jpg",
"-output_image" , "outputs/kida/result.jpg",
"-gpu" , -1,
"-print_iter" , 1,
"-save_iter" , 5
];
// var args = [
// "neural_style.lua",
// "-style_image" , "outputs/kida/jiburi.jpg",
// "-content_image" , "outputs/kida/kida.jpg",
// "-output_image" , "outputs/kida/result.jpg",
// "-gpu" , 0,
// "-print_iter" , 1,
// "-save_iter" , 5
// ];
console.log()
console.log( args.toString().replace(/,/g," ") );
console.log()
var exec = _child.spawn("th", args);
exec.stdout.on('data', function(data) {
console.log('[stdout]: ' + data);
//Here is where the output goes
});
exec.stderr.on('data', function(data) {
console.log('[stderr]: ' + data);
//Here is where the error output goes
});
exec.stdout.on('end', function(code) {
console.log('[end]: ' + code);
//Here you can get the exit code of the script
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment