diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-07 10:13:27 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-07 10:13:27 +0200 |
| commit | 47d9658375fc2003a69d51c663b182c3baf8a9c6 (patch) | |
| tree | 25c0ddff18f3cdc07e03a8c1b4801f90965066c8 /public/bundle.js | |
| parent | ed240db41cb8e2d8d3423a3aeade4c2ace1c5cf7 (diff) | |
switching epochs working again
Diffstat (limited to 'public/bundle.js')
| -rw-r--r-- | public/bundle.js | 117 |
1 files changed, 76 insertions, 41 deletions
diff --git a/public/bundle.js b/public/bundle.js index 9b7adf2..40a29b5 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -5449,13 +5449,13 @@ function onFrame(data) { var blob = new Blob([data.frame], { type: 'image/jpg' }); var url = URL.createObjectURL(blob); var img = new Image(); + var canvas = document.querySelector('.player canvas'); + if (!canvas) return console.error('no canvas for frame'); img.onload = function () { img.onload = null; last_frame = data.meta; URL.revokeObjectURL(url); - var canvas = document.querySelector('.player canvas'); - if (!canvas) return console.error('no canvas for frame'); - var ctx = canvas.getContext('2d'); + var ctx = canvas.getContext('2d-lodpi'); ctx.drawImage(img, 0, 0, canvas.width, canvas.height); if (recording) { console.log('record frame'); @@ -6115,8 +6115,8 @@ var _samplernn2 = _interopRequireDefault(_samplernn); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var moduleReducer = exports.moduleReducer = (0, _redux.combineReducers)({ - pix2wav: _pix2wav2.default, pix2pix: _pix2pix2.default, + pix2wav: _pix2wav2.default, samplernn: _samplernn2.default }); @@ -6265,6 +6265,7 @@ var load_directories = exports.load_directories = function load_directories(id) return function (dispatch) { var module = _pix2pix2.default.name; _util2.default.allProgress([datasetLoader.load(module), _actions2.default.socket.list_directory({ module: module, dir: 'sequences/pix2pix/' }), _actions2.default.socket.list_directory({ module: module, dir: 'datasets/pix2pix/' }), _actions2.default.socket.list_directory({ module: module, dir: 'checkpoints/pix2pix/' })], function (percent, i, n) { + console.log('pix2pix load progress', i, n); dispatch({ type: _types2.default.app.load_progress, progress: { i: i, n: n } }); }).then(function (res) { // console.log(res) @@ -6591,6 +6592,10 @@ var _live = __webpack_require__(/*! ../../../live/live.actions */ "./app/client/ var liveActions = _interopRequireWildcard(_live); +var _queue = __webpack_require__(/*! ../../../queue/queue.actions */ "./app/client/queue/queue.actions.js"); + +var queueActions = _interopRequireWildcard(_queue); + var _pix2pix = __webpack_require__(/*! ../pix2pix.tasks */ "./app/client/modules/pix2pix/pix2pix.tasks.js"); var pix2pixTasks = _interopRequireWildcard(_pix2pix); @@ -6613,14 +6618,14 @@ var Pix2PixLive = function (_Component) { function Pix2PixLive(props) { _classCallCheck(this, Pix2PixLive); + // if (! props.pix2pix || ! props.pix2pix.data) { var _this = _possibleConstructorReturn(this, (Pix2PixLive.__proto__ || Object.getPrototypeOf(Pix2PixLive)).call(this)); - if (!props.pix2pix || !props.pix2pix.data) { - props.pix2pixActions.load_directories(); - } - props.actions.get_params(); - props.actions.list_checkpoints('pix2pix'); - props.actions.list_sequences('pix2pix'); + props.actions.pix2pix.load_directories(); + // } + props.actions.live.get_params(); + props.actions.live.list_checkpoints('pix2pix'); + props.actions.live.list_sequences('pix2pix'); _this.changeCheckpoint = _this.changeCheckpoint.bind(_this); _this.changeEpoch = _this.changeEpoch.bind(_this); _this.changeSequence = _this.changeSequence.bind(_this); @@ -6634,30 +6639,30 @@ var Pix2PixLive = function (_Component) { key: 'componentWillUpdate', value: function componentWillUpdate(nextProps) { if (nextProps.opt.checkpoint_name && nextProps.opt.checkpoint_name !== this.props.opt.checkpoint_name) { - this.props.actions.list_epochs('pix2pix', nextProps.opt.checkpoint_name); + this.props.actions.live.list_epochs('pix2pix', nextProps.opt.checkpoint_name); } } }, { key: 'changeCheckpoint', - value: function changeCheckpoint(checkpoint_name) { - this.props.actions.load_epoch(checkpoint_name, 'latest'); + value: function changeCheckpoint(field, checkpoint_name) { + this.props.actions.live.load_epoch(checkpoint_name, 'latest'); } }, { key: 'changeEpoch', - value: function changeEpoch(epoch_name) { - this.props.actions.load_epoch(this.props.opt.checkpoint_name, epoch_name); + value: function changeEpoch(field, epoch_name) { + this.props.actions.live.load_epoch(this.props.opt.checkpoint_name, epoch_name); } }, { key: 'changeSequence', - value: function changeSequence(sequence) { + value: function changeSequence(field, sequence) { console.log('got sequence', sequence); - this.props.actions.load_sequence(sequence); + this.props.actions.live.load_sequence(sequence); } }, { key: 'seek', value: function seek(percentage) { var frame = Math.floor(percentage * (parseInt(this.props.frame.sequence_len) || 1) + 1); - this.props.actions.seek(frame); + this.props.actions.live.seek(frame); } }, { key: 'start', @@ -6666,21 +6671,20 @@ var Pix2PixLive = function (_Component) { var sequence = this.props.pix2pix.data.sequences[0].name; var checkpoint = this.props.pix2pix.data.checkpoints[0].name; console.log('starting up!', sequence, checkpoint); - this.props.pix2pixTasks.live_task(sequence, checkpoint); + this.props.actions.tasks.live_task(sequence, checkpoint); } }, { key: 'interrupt', value: function interrupt() { - // + this.props.actions.queue.stop_task('gpu'); } }, { key: 'togglePlaying', value: function togglePlaying() { - console.log('are we..........', this.props.opt.processing); if (this.props.opt.processing) { - this.props.actions.pause(); + this.props.actions.live.pause(); } else { - this.props.actions.play(); + this.props.actions.live.play(); } } }, { @@ -6688,7 +6692,7 @@ var Pix2PixLive = function (_Component) { value: function toggleRecording() { if (this.props.opt.recording) { (0, _player.stopRecording)(); - this.props.actions.pause(); + this.props.actions.live.pause(); } else { (0, _player.startRecording)(); } @@ -6720,7 +6724,7 @@ var Pix2PixLive = function (_Component) { name: 'send_image', title: 'view mode', options: ['a', 'b', 'sequence', 'recursive'], - onChange: this.props.actions.set_param + onChange: this.props.actions.live.set_param }), (0, _preact.h)(_common.Select, { name: 'sequence_name', @@ -6920,21 +6924,49 @@ var Pix2PixLive = function (_Component) { } if (!this.props.opt.processing) { return (0, _preact.h)( + 'div', + null, + (0, _preact.h)( + _common.Button, + { + title: 'Not processing', + onClick: this.togglePlaying + }, + 'Restart' + ), + (0, _preact.h)( + _common.Button, + { + title: 'GPU Busy', + onClick: function onClick() { + return _this2.interrupt(); + } + }, + 'Interrupt' + ) + ); + } + return (0, _preact.h)( + 'div', + null, + (0, _preact.h)( _common.Button, { - title: 'Not processing', + title: 'Processing', onClick: this.togglePlaying }, - 'Restart' - ); - } - return (0, _preact.h)( - _common.Button, - { - title: 'Processing', - onClick: this.togglePlaying - }, - 'Pause' + 'Pause' + ), + (0, _preact.h)( + _common.Button, + { + title: 'GPU Busy', + onClick: function onClick() { + return _this2.interrupt(); + } + }, + 'Interrupt' + ) ); } }]); @@ -6959,9 +6991,12 @@ var mapStateToProps = function mapStateToProps(state) { var mapDispatchToProps = function mapDispatchToProps(dispatch, ownProps) { return { - actions: (0, _redux.bindActionCreators)(liveActions, dispatch), - pix2pixActions: (0, _redux.bindActionCreators)(pix2pixActions, dispatch), - pix2pixTasks: (0, _redux.bindActionCreators)(pix2pixTasks, dispatch), s: s + actions: { + live: (0, _redux.bindActionCreators)(liveActions, dispatch), + queue: (0, _redux.bindActionCreators)(queueActions, dispatch), + pix2pix: (0, _redux.bindActionCreators)(pix2pixActions, dispatch), + tasks: (0, _redux.bindActionCreators)(pix2pixTasks, dispatch), s: s + } }; }; @@ -11220,7 +11255,7 @@ var systemInitialState = { name: 'loading' }, app: { - tool: 'samplernn' + tool: 'pix2pix' }, server: { connected: false, @@ -11253,7 +11288,7 @@ var systemInitialState = { stderr: "" }; -var modules = ['samplernn', 'pix2pix', 'pix2wav'].reduce(function (a, b) { +var modules = ['pix2pix', 'samplernn', 'pix2wav'].reduce(function (a, b) { return a[b] = b, a; }, {}); |
