From cc36bb1ad49dc054b32f20a97386a938a529fe0e Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 17 Jun 2018 21:16:57 +0200 Subject: pix2pixhd modules --- app/client/modules/index.js | 3 +- app/client/modules/module.reducer.js | 2 + app/client/modules/pix2pix/index.js | 11 - app/client/modules/pix2pixhd/index.js | 44 + app/client/modules/pix2pixhd/pix2pixhd.actions.js | 137 + app/client/modules/pix2pixhd/pix2pixhd.module.js | 7 + app/client/modules/pix2pixhd/pix2pixhd.reducer.js | 23 + app/client/modules/pix2pixhd/pix2pixhd.tasks.js | 54 + .../modules/pix2pixhd/views/pix2pixhd.live.js | 334 + .../modules/pix2pixhd/views/pix2pixhd.new.js | 33 + .../modules/pix2pixhd/views/pix2pixhd.show.js | 126 + app/client/modules/pix2wav/index.js | 11 - app/client/types.js | 3 + app/relay/modules/pix2pix.js | 12 - app/relay/modules/pix2pixhd.js | 137 +- public/bundle.js | 69160 ++++++++++++++++++- public/bundle.js.map | 2 +- 17 files changed, 70054 insertions(+), 45 deletions(-) create mode 100644 app/client/modules/pix2pixhd/index.js create mode 100644 app/client/modules/pix2pixhd/pix2pixhd.actions.js create mode 100644 app/client/modules/pix2pixhd/pix2pixhd.module.js create mode 100644 app/client/modules/pix2pixhd/pix2pixhd.reducer.js create mode 100644 app/client/modules/pix2pixhd/pix2pixhd.tasks.js create mode 100644 app/client/modules/pix2pixhd/views/pix2pixhd.live.js create mode 100644 app/client/modules/pix2pixhd/views/pix2pixhd.new.js create mode 100644 app/client/modules/pix2pixhd/views/pix2pixhd.show.js diff --git a/app/client/modules/index.js b/app/client/modules/index.js index 30685f2..6cc6cd4 100644 --- a/app/client/modules/index.js +++ b/app/client/modules/index.js @@ -1,7 +1,8 @@ import pix2pix from './pix2pix' +import pix2pixhd from './pix2pixhd' import pix2wav from './pix2wav' import samplernn from './samplernn' export default { - pix2pix, pix2wav, samplernn + pix2pix, pix2pixhd, pix2wav, samplernn } diff --git a/app/client/modules/module.reducer.js b/app/client/modules/module.reducer.js index a232372..0598960 100644 --- a/app/client/modules/module.reducer.js +++ b/app/client/modules/module.reducer.js @@ -1,11 +1,13 @@ import { combineReducers } from 'redux' import pix2pixReducer from './pix2pix/pix2pix.reducer' +import pix2pixhdReducer from './pix2pixhd/pix2pixhd.reducer' import pix2wavReducer from './pix2wav/pix2wav.reducer' import samplernnReducer from './samplernn/samplernn.reducer' export const moduleReducer = combineReducers({ pix2pix: pix2pixReducer, + pix2pixhd: pix2pixhdReducer, pix2wav: pix2wavReducer, samplernn: samplernnReducer }) diff --git a/app/client/modules/pix2pix/index.js b/app/client/modules/pix2pix/index.js index 21bffe7..60e49fa 100644 --- a/app/client/modules/pix2pix/index.js +++ b/app/client/modules/pix2pix/index.js @@ -34,19 +34,8 @@ function links(){ return [ { url: '/pix2pix/new/', name: 'new' }, { url: '/pix2pix/sequences/', name: 'sequences' }, - { name: 'train' }, - { name: 'process' }, { url: '/pix2pix/live/', name: 'live' }, ] - return ( - - new - sequences - train - process - live - - ) } export default { diff --git a/app/client/modules/pix2pixhd/index.js b/app/client/modules/pix2pixhd/index.js new file mode 100644 index 0000000..331fe01 --- /dev/null +++ b/app/client/modules/pix2pixhd/index.js @@ -0,0 +1,44 @@ +import { h, Component } from 'preact' +import { Route, Link } from 'react-router-dom' + +import actions from '../../actions' + +import util from '../../util' + +import Pix2PixHDNew from './views/pix2pixhd.new' +import Pix2PixHDShow from './views/pix2pixhd.show' +import Pix2PixHDLive from './views/pix2pixhd.live' + +class router { + componentWillMount(){ + actions.system.changeTool('pix2pixhd') + document.body.style.backgroundImage = 'linear-gradient(' + (util.randint(40)+40) + 'deg, #fde, #ffe)' + } + componentWillReceiveProps(){ + actions.system.changeTool('pix2pixhd') + document.body.style.backgroundImage = 'linear-gradient(' + (util.randint(40)+40) + 'deg, #fde, #ffe)' + } + render(){ + return ( +
+ + + + +
+ ) + } +} + +function links(){ + return [ + { url: '/pix2pixhd/new/', name: 'new' }, + { url: '/pix2pixhd/sequences/', name: 'sequences' }, + { url: '/pix2pixhd/live/', name: 'live' }, + ] +} + +export default { + name: 'pix2pixhd', + router, links, +} diff --git a/app/client/modules/pix2pixhd/pix2pixhd.actions.js b/app/client/modules/pix2pixhd/pix2pixhd.actions.js new file mode 100644 index 0000000..1ee4886 --- /dev/null +++ b/app/client/modules/pix2pixhd/pix2pixhd.actions.js @@ -0,0 +1,137 @@ +import uuidv1 from 'uuid/v1' + +import socket from '../../socket' +import types from '../../types' + +import * as datasetLoader from '../../dataset/dataset.loader' + +import actions from '../../actions' + +import util from '../../util' + +import pix2pixhdModule from './pix2pixhd.module' + +export const load_directories = (id) => (dispatch) => { + const module = pix2pixhdModule.name + util.allProgress([ + datasetLoader.load(module), + actions.socket.list_directory({ module, dir: 'sequences' }), + actions.socket.list_directory({ module, dir: 'datasets' }), + actions.socket.list_directory({ module, dir: 'checkpoints' }), + // actions.socket.disk_usage({ module, dir: 'datasets' }), + ], (percent, i, n) => { + console.log('pix2pixhd load progress', i, n) + dispatch({ type: types.app.load_progress, progress: { i, n }}) + }).then(res => { + const [datasetApiReport, sequences, datasets, checkpoints] = res //, datasets, results, output, datasetUsage, lossReport] = res + const { + folderLookup, + fileLookup, + datasetLookup, + folders, + files, + unsortedFolder, + } = datasetApiReport + // console.log(datasetUsage) + + const sequenceDirectories = sequences.filter(s => s.dir) + console.log(sequenceDirectories) + sequenceDirectories.forEach(dir => { + const dataset = datasetLoader.getDataset(module, datasetLookup, dir.name) + dataset.isBuilt = true + console.log(dir.name, dataset) + }) + + datasets.filter(s => s.dir).forEach(dir => { + const dataset = datasetLoader.getDataset(module, datasetLookup, dir.name) + dataset.hasDataset = true + }) + + const checkpointDirectories = checkpoints.filter(s => s.dir) + checkpointDirectories.forEach(dir => { + const dataset = datasetLoader.getDataset(module, datasetLookup, dir.name) + dataset.hasCheckpoints = true + dataset.checkpoints = [dir] + }) + + // console.log(res) + + // flatDatasets.forEach(file => { + // file.uuid = uuidv1() + // fileLookup[file.uuid] = file + // const name = file.name.split('.')[0] + // const dataset = datasetLoader.getDataset(module, datasetLookup, name, unsortedFolder, file.date) + // file.persisted = false + // dataset.input.push(file.uuid) + // }) + + // // exp:coccokit_3-frame_sizes:8,2-n_rnn:2-dataset:coccokit_3 + // const checkpoints = results.filter(s => s.dir).map(s => { + // const checkpoint = s.name + // .split('-') + // .map(s => s.split(':')) + // .filter(b => b.length && b[1]) + // .reduce((a,b) => (a[b[0]] = b[1]) && a, {}) + // checkpoint.name = checkpoint.name || checkpoint.dataset || checkpoint.exp + // checkpoint.date = s.date + // checkpoint.dir = s + // checkpoint.persisted = false + // const dataset = datasetLoader.getDataset(module, datasetLookup, checkpoint.name, unsortedFolder, checkpoint.date) + // const loss = lossReport[checkpoint.name] + // if (loss) { + // dataset.epoch = checkpoint.epoch = loss.length + // checkpoint.training_loss = loss + // } + // dataset.checkpoints.push(checkpoint) + // return checkpoint + // }) + + // output.map(file => { + // file.uuid = uuidv1() + // fileLookup[file.uuid] = file + // const pair = file.name.split('.')[0].split('-') + // const dataset = datasetLoader.getDataset(module, datasetLookup, pair[0], unsortedFolder, file.date) + // file.persisted = false + // file.epoch = parseInt(file.epoch || pair[1].replace(/^\D+/, '')) || 0 + // dataset.epoch = Math.max(file.epoch, dataset.epoch || 0) + // // here check if the file exists in dataset, if so just check that it's persisted + // const found = dataset.output.some(file_id => { + // // if (f.name === + // if (fileLookup[file_id].name === file.name) { + // fileLookup[file_id].persisted = true + // return true + // } + // return false + // }) + // if (! found) { + // dataset.output.push(file.uuid) + // } + // }) + + dispatch({ + type: types.dataset.load, + data: { + module, + folderLookup, + fileLookup, + datasetLookup, + folders, files, + sequences: sequenceDirectories, + datasets, + checkpoints: checkpointDirectories, + }, + }) + if (id) { + console.log('folder id', id) + dispatch({ + type: types.dataset.set_folder, + data: { + folder_id: id, + module + }, + }) + } + }).catch(e => { + console.error(e) + }) +} diff --git a/app/client/modules/pix2pixhd/pix2pixhd.module.js b/app/client/modules/pix2pixhd/pix2pixhd.module.js new file mode 100644 index 0000000..4dbb55c --- /dev/null +++ b/app/client/modules/pix2pixhd/pix2pixhd.module.js @@ -0,0 +1,7 @@ +const pix2pixhdModule = { + name: 'pix2pixhd', + displayName: 'Pix2PixHD', + datatype: 'video', +} + +export default pix2pixhdModule diff --git a/app/client/modules/pix2pixhd/pix2pixhd.reducer.js b/app/client/modules/pix2pixhd/pix2pixhd.reducer.js new file mode 100644 index 0000000..a21f4d5 --- /dev/null +++ b/app/client/modules/pix2pixhd/pix2pixhd.reducer.js @@ -0,0 +1,23 @@ +import types from '../../types' +import datasetReducer from '../../dataset/dataset.reducer' + +const pix2pixhdInitialState = { + loading: true, + progress: { i: 0, n: 0 }, + error: null, + folder_id: 0, + data: null, +} + +const pix2pixhdReducer = (state = pix2pixhdInitialState, action) => { + if (action.data && action.data.module === 'pix2pixhd') { + state = datasetReducer(state, action) + } + + switch (action.type) { + default: + return state + } +} + +export default pix2pixhdReducer diff --git a/app/client/modules/pix2pixhd/pix2pixhd.tasks.js b/app/client/modules/pix2pixhd/pix2pixhd.tasks.js new file mode 100644 index 0000000..2e7cbbd --- /dev/null +++ b/app/client/modules/pix2pixhd/pix2pixhd.tasks.js @@ -0,0 +1,54 @@ +import uuidv1 from 'uuid/v1' + +import socket from '../../socket' +import types from '../../types' + +import actions from '../../actions' + +import module from './pix2pixhd.module' + +export const fetch_task = (url, file_id, dataset) => dispatch => { + if (! url) return console.log('input file inaccessible (no url)') + const task = { + module: module.name, + activity: 'fetch', + dataset: dataset, + opt: { + url, + file_id, + dataset, + } + } + return actions.queue.add_task(task) +} + +export const train_task = (dataset, folder_id, epochs=1) => dispatch => { + const task = { + module: module.name, + activity: 'train', + dataset: dataset.name, + epoch: 0, + epochs: epochs, + opt: { + folder_id: folder_id, + load_size: 264, // switch to 256 for pix2wav + } + } + console.log(task) + return actions.queue.add_task(task) +} + +export const live_task = (sequence, checkpoint) => dispatch => { + const task = { + module: module.name, + activity: 'live', + dataset: sequence, + checkpoint, + opt: { + poll_delay: 0.09, + } + } + console.log(task) + console.log('add live task') + return actions.queue.add_task(task) +} diff --git a/app/client/modules/pix2pixhd/views/pix2pixhd.live.js b/app/client/modules/pix2pixhd/views/pix2pixhd.live.js new file mode 100644 index 0000000..3f027a1 --- /dev/null +++ b/app/client/modules/pix2pixhd/views/pix2pixhd.live.js @@ -0,0 +1,334 @@ +import { h, Component } from 'preact' +import { bindActionCreators } from 'redux' +import { connect } from 'react-redux' + +import { + ParamGroup, Param, Player, + Slider, Select, Button, Loading +} from '../../../common/' + +import { startRecording, stopRecording, saveFrame, toggleFPS } from '../../../live/player' + +import * as liveActions from '../../../live/live.actions' +import * as queueActions from '../../../queue/queue.actions' +import * as pix2pixhdTasks from '../pix2pixhd.tasks' +import * as pix2pixhdActions from '../pix2pixhd.actions' + +class Pix2PixHDLive extends Component { + constructor(props){ + super() + // if (! props.pix2pixhd || ! props.pix2pixhd.data) { + props.actions.pix2pixhd.load_directories() + // } + props.actions.live.get_params() + // props.actions.live.list_checkpoints('pix2pixhd') + // props.actions.live.list_sequences('pix2pixhd') + this.changeCheckpoint = this.changeCheckpoint.bind(this) + this.changeEpoch = this.changeEpoch.bind(this) + this.changeSequence = this.changeSequence.bind(this) + this.seek = this.seek.bind(this) + this.togglePlaying = this.togglePlaying.bind(this) + this.toggleRecording = this.toggleRecording.bind(this) + } + componentWillUpdate(nextProps) { + if (nextProps.opt.checkpoint_name && nextProps.opt.checkpoint_name !== this.props.opt.checkpoint_name) { + this.props.actions.live.list_epochs('pix2pixhd', nextProps.opt.checkpoint_name) + } + } + changeCheckpoint(field, checkpoint_name){ + this.props.actions.live.load_epoch(checkpoint_name, 'latest') + } + changeEpoch(field, epoch_name){ + this.props.actions.live.load_epoch(this.props.opt.checkpoint_name, epoch_name) + } + changeSequence(field, sequence){ + console.log('load sequence', sequence) + this.props.actions.live.load_sequence(sequence) + } + seek(percentage){ + const frame = Math.floor(percentage * (parseInt(this.props.frame.sequence_len) || 1) + 1) + console.log("seek to frame", percentage, frame) + this.props.actions.live.seek(frame) + } + start(){ + // console.log(this.props) + const sequence = this.props.pix2pixhd.data.sequences[0].name + const checkpoint = this.props.pix2pixhd.data.checkpoints[0].name + console.log('starting up!', sequence, checkpoint) + this.props.actions.tasks.live_task(sequence, checkpoint) + } + interrupt(){ + this.props.actions.queue.stop_task('gpu') + } + togglePlaying(){ + if (this.props.opt.processing) { + this.props.actions.live.pause() + } else { + this.props.actions.live.play() + } + } + toggleRecording(){ + if (this.props.opt.recording){ + stopRecording() + this.props.actions.live.pause() + } else { + startRecording() + } + } + render(){ + // console.log(this.props) + if (this.props.pix2pixhd.loading) { + return + } + return ( +
+ +
+
+ + file.name)} + onChange={this.changeSequence} + /> + + + + {this.renderRestartButton()} + + + { + // now storing frames on server... + }} + > + + +

{this.props.last_message}

+
+
+
+ + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + +
+
+
+ ) + } + renderRestartButton(){ + if (this.props.runner.gpu.status === 'IDLE') { + return ( + + ) + } + if (this.props.runner.gpu.task.module !== 'pix2pixhd') { + return ( + + ) + } + if (! this.props.opt.processing) { + return ( +
+ + +
+ ) + } + return ( +
+ + +
+ ) + } +} +function timeInSeconds(n){ + return n.toFixed(1) + ' s.' +} +const mapStateToProps = state => ({ + last_message: state.live.last_message, + opt: state.live.opt, + frame: state.live.frame, + checkpoints: state.live.checkpoints, + epochs: state.live.epochs, + sequences: state.live.sequences, + runner: state.system.runner, + pix2pixhd: state.module.pix2pixhd, +}) + +const mapDispatchToProps = (dispatch, ownProps) => ({ + actions: { + live: bindActionCreators(liveActions, dispatch), + queue: bindActionCreators(queueActions, dispatch), + pix2pixhd: bindActionCreators(pix2pixhdActions, dispatch), + tasks: bindActionCreators(pix2pixhdTasks, dispatch),s + } +}) + +export default connect(mapStateToProps, mapDispatchToProps)(Pix2PixHDLive) diff --git a/app/client/modules/pix2pixhd/views/pix2pixhd.new.js b/app/client/modules/pix2pixhd/views/pix2pixhd.new.js new file mode 100644 index 0000000..d861229 --- /dev/null +++ b/app/client/modules/pix2pixhd/views/pix2pixhd.new.js @@ -0,0 +1,33 @@ +import { h, Component } from 'preact' +import { bindActionCreators } from 'redux' +import { connect } from 'react-redux' +import { Link } from 'react-router-dom' +import util from '../../../util' + +import { Views } from '../../../common' + +import * as pix2pixhdActions from '../pix2pixhd.actions' +import pix2pixhdModule from '../pix2pixhd.module' + +function Pix2PixHDNew(props){ + return ( + + ) +} + +const mapStateToProps = state => ({ + pix2pixhd: state.module.pix2pixhd, +}) + +const mapDispatchToProps = (dispatch, ownProps) => ({ + actions: bindActionCreators(pix2pixhdActions, dispatch), +}) + +export default connect(mapStateToProps, mapDispatchToProps)(Pix2PixHDNew) + diff --git a/app/client/modules/pix2pixhd/views/pix2pixhd.show.js b/app/client/modules/pix2pixhd/views/pix2pixhd.show.js new file mode 100644 index 0000000..5777ac0 --- /dev/null +++ b/app/client/modules/pix2pixhd/views/pix2pixhd.show.js @@ -0,0 +1,126 @@ +import { h, Component } from 'preact' +import { bindActionCreators } from 'redux' +import { connect } from 'react-redux' +import util from '../../../util' + +import * as pix2pixhdActions from '../pix2pixhd.actions' +import * as pix2pixhdTasks from '../pix2pixhd.tasks' + +import { Loading, CurrentTask, FileList, FileRow } from '../../../common' +import DatasetForm from '../../../dataset/dataset.form' +import NewDatasetForm from '../../../dataset/dataset.new' +import UploadStatus from '../../../dataset/upload.status' + +import DatasetComponent from '../../../dataset/dataset.component' + +import pix2pixhdModule from '../pix2pixhd.module' + +class Pix2PixHDShow extends Component { + constructor(props){ + super(props) + this.datasetActions = this.datasetActions.bind(this) + } + componentWillMount(){ + const id = this.props.match.params.id || localStorage.getItem('pix2pixhd.last_id') + console.log('load dataset:', id) + const { match, pix2pixhd, actions } = this.props + if (id === 'new') return + if (id) { + if (parseInt(id)) localStorage.setItem('pix2pixhd.last_id', id) + if (! pix2pixhd.folder || pix2pixhd.folder.id !== id) { + actions.load_directories(id) + } + } else { + this.props.history.push('/pix2pixhd/new/') + } + } + render(){ + const { pix2pixhd, match, history } = this.props + const { folderLookup } = (pix2pixhd.data || {}) + const folder = (folderLookup || {})[pix2pixhd.folder_id] || {} + + return ( +
+
+
+

{folder ? folder.name : }

+ +
+
+
+ {folder && folder.name && folder.name !== 'unsorted' && + + } +
+ + +
+
+ + + { + e.preventDefault() + e.stopPropagation() + console.log('picked a file', file) + }} + datasetActions={this.datasetActions} + /> +
+ ) + } + datasetActions(dataset, isFetching=false, isProcessing=false){ + const { pix2pixhd, remote } = this.props + const input = pix2pixhd.data.fileLookup[dataset.input[0]] + if (! input) return null + if (input.name && input.name.match(/(gif|jpe?g|png)$/i)) return null + console.log(dataset) + return ( +
+
+ remote.train_task(dataset, pix2pixhd.folder_id, 1)}>train + remote.train_task(dataset, pix2pixhd.folder_id, 5)}>5x + remote.train_task(dataset, pix2pixhd.folder_id, 10)}>10x + remote.train_task(dataset, pix2pixhd.folder_id, 20)}>20x + remote.train_task(dataset, pix2pixhd.folder_id, 50)}>50x +
+ {dataset.isBuilt + ?
+ {'fetched '} + remote.clear_cache_task(dataset)}>rm +
+ : isFetching + ?
+ {'fetching'} +
+ :
+ remote.fetch_task(input.url, input.id, dataset.name)}>fetch +
+ } +
+ ) + } +} + +const mapStateToProps = state => ({ + pix2pixhd: state.module.pix2pixhd, +}) + +const mapDispatchToProps = (dispatch, ownProps) => ({ + actions: bindActionCreators(pix2pixhdActions, dispatch), + remote: bindActionCreators(pix2pixhdTasks, dispatch), +}) + +export default connect(mapStateToProps, mapDispatchToProps)(Pix2PixHDShow) diff --git a/app/client/modules/pix2wav/index.js b/app/client/modules/pix2wav/index.js index 1bc953a..75f71e9 100644 --- a/app/client/modules/pix2wav/index.js +++ b/app/client/modules/pix2wav/index.js @@ -34,19 +34,8 @@ function links(){ return [ { url: '/pix2wav/new/', name: 'new' }, { url: '/pix2wav/datasets/', name: 'datasets' }, - { name: 'train' }, - { name: 'process' }, { url: '/pix2wav/live/', name: 'live' }, ] - return ( - - new - datasets - train - process - live - - ) } export default { diff --git a/app/client/types.js b/app/client/types.js index efef7e2..8021a0e 100644 --- a/app/client/types.js +++ b/app/client/types.js @@ -104,6 +104,9 @@ export default { pix2pix: with_type('pix2pix', [ 'init', 'set_folder' ]), + pix2pixhd: with_type('pix2pixhd', [ + 'init', 'set_folder' + ]), pix2wav: with_type('pix2wav', [ 'init', 'set_folder' ]), diff --git a/app/relay/modules/pix2pix.js b/app/relay/modules/pix2pix.js index 3169fce..101eea8 100644 --- a/app/relay/modules/pix2pix.js +++ b/app/relay/modules/pix2pix.js @@ -4,15 +4,6 @@ import fs from 'fs' const name = 'pix2pix' const cwd = process.env.PIX2PIX_CWD || path.join(process.env.HOME, 'code/' + name + '/') -/* - what are all the tasks that pix2pix has to do? - - fetch url - - fetch youtube - - ffmpeg movie into frames - - unzip zip file into sequence - - list sequences -*/ - const fetch = { type: 'perl', script: 'get.pl', @@ -26,9 +17,6 @@ const fetch = { for (let line of lines) { console.log(line) if ( line.match(/^created dataset: /) ) { - console.log("_______________________________________-") - console.log("_______________________________________-") - console.log("_______________________________________-") let tag = line.split(': ')[1].trim() task.dataset = tag // task.opt.filename = filename diff --git a/app/relay/modules/pix2pixhd.js b/app/relay/modules/pix2pixhd.js index 9aa30d0..c5f9be5 100644 --- a/app/relay/modules/pix2pixhd.js +++ b/app/relay/modules/pix2pixhd.js @@ -1,5 +1,138 @@ import path from 'path' +import fs from 'fs' + +const name = 'pix2pixhd' +const cwd = process.env.PIX2PIXHD_CWD || path.join(process.env.HOME, 'code/' + name + '/') + +const fetch = { + type: 'perl', + script: 'get.pl', + params: (task) => { + console.log(task) + return [ task.module, task.opt.url ] + }, + listen: (task, res, i) => { + // relay the new dataset name from youtube-dl or w/e + const lines = res.split('\n') + for (let line of lines) { + console.log(line) + if ( line.match(/^created dataset: /) ) { + let tag = line.split(': ')[1].trim() + task.dataset = tag + // task.opt.filename = filename + console.log(">>>>>> created dataset", tag) + return { type: 'progress', action: 'resolve_dataset', task } + } + } + return null + }, + after: 'build', +} +const build = { + type: 'perl', + script: 'build_dataset.pl', + params: (task) => { + return [ + task.dataset, + ] + } +} +const train = { + type: 'pytorch', + script: 'train.py', + params: (task) => { + let epoch = 0 + + const datasets_path = path.join(cwd, 'datasets', task.dataset) + const checkpoints_path = path.join(cwd, 'checkpoints', task.dataset) + if (fs.existsSync(checkpoints_path)) { + try { + const checkpoints = fs.readdirSync(checkpoints_path) + checkpoints.forEach(c => { + epoch = Math.max(parseInt(c.name) || 0, epoch) + }) + console.log(task.module, task.dataset, epoch, task.epochs) + } catch (e) { } + } + let args = [ + '--dataroot', datasets_path, + '--module_name', task.module, + '--name', task.dataset, + '--model', 'pix2pixhd', + '--label_nc', 0, '--no_instance', + '--niter', task.epochs, + '--niter_decay', 0, + ] + if (epoch) { + args = args.concat([ + '--epoch_count', task.epoch + task.epochs + 1, + '--which_epoch', 'latest', + '--continue_train', + ]) + } + return args + }, +} +const generate = { + type: 'pytorch', + script: 'test.py', + params: (task) => { + return [ + '--dataroot', '/sequences/' + task.module + '/' + task.dataset, + '--module_name', task.module, + '--name', task.dataset, + '--start_img', '/sequences/' + task.module + '/' + task.dataset + '/frame_00001.png', + '--how_many', 1000, + '--model', 'test', + '--aspect_ratio', 1.777777, + '--which_model_netG', 'unet_256', + '--which_direction', 'AtoB', + '--dataset_mode', 'test', + '--loadSize', 256, + '--fineSize', 256, + '--norm', 'batch' + ] + }, +} +const live = { + type: 'pytorch', + script: 'live-mogrify.py', + params: (task) => { + console.log(task) + const opt = task.opt || {} + return [ + '--dataroot', path.join(cwd, 'sequences', task.module, task.dataset), + '--start_img', path.join(cwd, 'sequences', task.module, task.dataset, 'frame_00001.png'), + '--checkpoint-name', task.checkpoint, + '--experiment', task.checkpoint, + '--name', task.checkpoint, + '--module_name', task.module, + '--sequence-name', task.dataset, + '--recursive', '--recursive-frac', 0.1, + '--sequence', '--sequence-frac', 0.3, + '--process-frac', 0.5, + '--nThreads', 0, + '--transition-min', 0.05, + '--how_many', 1000000, '--transition-period', 1000, + '--loadSize', 256, '--fineSize', 256, + '--just-copy', '--poll_delay', opt.poll_delay || 0.09, + '--model', 'test', + '--which_model_netG', 'unet_256', + '--which_direction', 'AtoB', + '--dataset_mode', 'recursive', + '--which_epoch', 'latest', + '--norm', 'batch', + ] + }, +} export default { - enabled: false, -} \ No newline at end of file + name, cwd, + activities: { + fetch, + build, + train, + generate, + live, + } +} diff --git a/public/bundle.js b/public/bundle.js index 0a0d1c0..0467c83 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -1,16 +1,69162 @@ -!function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=256)}([function(t,e,n){t.exports=n(255)()},function(t,e,n){"use strict";n.r(e),n.d(e,"h",function(){return s}),n.d(e,"createElement",function(){return s}),n.d(e,"cloneElement",function(){return l}),n.d(e,"Component",function(){return F}),n.d(e,"render",function(){return N}),n.d(e,"rerender",function(){return f}),n.d(e,"options",function(){return i});var i={},r=[],o=[];function s(t,e){var n,s,a,u,l=o;for(u=arguments.length;u-- >2;)r.push(arguments[u]);for(e&&null!=e.children&&(r.length||r.push(e.children),delete e.children);r.length;)if((s=r.pop())&&void 0!==s.pop)for(u=s.length;u--;)r.push(s[u]);else"boolean"==typeof s&&(s=null),(a="function"!=typeof t)&&(null==s?s="":"number"==typeof s?s=String(s):"string"!=typeof s&&(a=!1)),a&&n?l[l.length-1]+=s:l===o?l=[s]:l.push(s),n=a;var c=new function(){};return c.nodeName=t,c.children=l,c.attributes=null==e?void 0:e,c.key=null==e?void 0:e.key,void 0!==i.vnode&&i.vnode(c),c}function a(t,e){for(var n in e)t[n]=e[n];return t}var u="function"==typeof Promise?Promise.resolve().then.bind(Promise.resolve()):setTimeout;function l(t,e){return s(t.nodeName,a(a({},t.attributes),e),arguments.length>2?[].slice.call(arguments,2):t.children)}var c=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,h=[];function p(t){!t._dirty&&(t._dirty=!0)&&1==h.push(t)&&(i.debounceRendering||u)(f)}function f(){var t,e=h;for(h=[];t=e.pop();)t._dirty&&R(t)}function d(t,e){return t.normalizedNodeName===e||t.nodeName.toLowerCase()===e.toLowerCase()}function y(t){var e=a({},t.attributes);e.children=t.children;var n=t.nodeName.defaultProps;if(void 0!==n)for(var i in n)void 0===e[i]&&(e[i]=n[i]);return e}function m(t){var e=t.parentNode;e&&e.removeChild(t)}function _(t,e,n,i,r){if("className"===e&&(e="class"),"key"===e);else if("ref"===e)n&&n(null),i&&i(t);else if("class"!==e||r)if("style"===e){if(i&&"string"!=typeof i&&"string"!=typeof n||(t.style.cssText=i||""),i&&"object"==typeof i){if("string"!=typeof n)for(var o in n)o in i||(t.style[o]="");for(var o in i)t.style[o]="number"==typeof i[o]&&!1===c.test(o)?i[o]+"px":i[o]}}else if("dangerouslySetInnerHTML"===e)i&&(t.innerHTML=i.__html||"");else if("o"==e[0]&&"n"==e[1]){var s=e!==(e=e.replace(/Capture$/,""));e=e.toLowerCase().substring(2),i?n||t.addEventListener(e,v,s):t.removeEventListener(e,v,s),(t._listeners||(t._listeners={}))[e]=i}else if("list"!==e&&"type"!==e&&!r&&e in t)!function(t,e,n){try{t[e]=n}catch(t){}}(t,e,null==i?"":i),null!=i&&!1!==i||t.removeAttribute(e);else{var a=r&&e!==(e=e.replace(/^xlink:?/,""));null==i||!1===i?a?t.removeAttributeNS("http://www.w3.org/1999/xlink",e.toLowerCase()):t.removeAttribute(e):"function"!=typeof i&&(a?t.setAttributeNS("http://www.w3.org/1999/xlink",e.toLowerCase(),i):t.setAttribute(e,i))}else t.className=i||""}function v(t){return this._listeners[t.type](i.event&&i.event(t)||t)}var g=[],b=0,w=!1,S=!1;function k(){for(var t;t=g.pop();)i.afterMount&&i.afterMount(t),t.componentDidMount&&t.componentDidMount()}function T(t,e,n,i,r,o){b++||(w=null!=r&&void 0!==r.ownerSVGElement,S=null!=t&&!("__preactattr_"in t));var s=x(t,e,n,i,o);return r&&s.parentNode!==r&&r.appendChild(s),--b||(S=!1,o||k()),s}function x(t,e,n,i,r){var o=t,s=w;if(null!=e&&"boolean"!=typeof e||(e=""),"string"==typeof e||"number"==typeof e)return t&&void 0!==t.splitText&&t.parentNode&&(!t._component||r)?t.nodeValue!=e&&(t.nodeValue=e):(o=document.createTextNode(e),t&&(t.parentNode&&t.parentNode.replaceChild(o,t),O(t,!0))),o.__preactattr_=!0,o;var a,u,l=e.nodeName;if("function"==typeof l)return function(t,e,n,i){var r=t&&t._component,o=r,s=t,a=r&&t._componentConstructor===e.nodeName,u=a,l=y(e);for(;r&&!u&&(r=r._parentComponent);)u=r.constructor===e.nodeName;r&&u&&(!i||r._component)?(M(r,l,3,n,i),t=r.base):(o&&!a&&(j(o),t=s=null),r=E(e.nodeName,l,n),t&&!r.nextBase&&(r.nextBase=t,s=null),M(r,l,1,n,i),t=r.base,s&&t!==s&&(s._component=null,O(s,!1)));return t}(t,e,n,i);if(w="svg"===l||"foreignObject"!==l&&w,l=String(l),(!t||!d(t,l))&&(a=l,(u=w?document.createElementNS("http://www.w3.org/2000/svg",a):document.createElement(a)).normalizedNodeName=a,o=u,t)){for(;t.firstChild;)o.appendChild(t.firstChild);t.parentNode&&t.parentNode.replaceChild(o,t),O(t,!0)}var c=o.firstChild,h=o.__preactattr_,p=e.children;if(null==h){h=o.__preactattr_={};for(var f=o.attributes,v=f.length;v--;)h[f[v].name]=f[v].value}return!S&&p&&1===p.length&&"string"==typeof p[0]&&null!=c&&void 0!==c.splitText&&null==c.nextSibling?c.nodeValue!=p[0]&&(c.nodeValue=p[0]):(p&&p.length||null!=c)&&function(t,e,n,i,r){var o,s,a,u,l,c=t.childNodes,h=[],p={},f=0,y=0,_=c.length,v=0,g=e?e.length:0;if(0!==_)for(var b=0;b<_;b++){var w=c[b],S=w.__preactattr_,k=g&&S?w._component?w._component.__key:S.key:null;null!=k?(f++,p[k]=w):(S||(void 0!==w.splitText?!r||w.nodeValue.trim():r))&&(h[v++]=w)}if(0!==g)for(var b=0;b0;)n[i]=arguments[i+2];if(!A(t))return t;var r=t.attributes||t.props,s=[Object(o.h)(t.nodeName||t.type,C({},r),t.children||r&&r.children),e];return n&&n.length?s.push(n):e&&e.children&&s.push(e.children),P(o.cloneElement.apply(void 0,s))},isValidElement:A,findDOMNode:function(t){return t&&t.base||t},unmountComponentAtNode:function(t){var e=t._preactCompatRendered&&t._preactCompatRendered.base;return!(!e||e.parentNode!==t||(Object(o.render)(Object(o.h)(f),t,e),0))},Component:B,PureComponent:U,unstable_renderSubtreeIntoContainer:function(t,e,n,i){var r=_(Object(o.h)(v,{context:t.context},e),n),s=r._component||r.base;return i&&i.call(s,r),s},__spread:C};e.d=z}).call(this,n(38))},function(t,e,n){"use strict";t.exports=function(){}},function(t,e,n){"use strict";n.r(e),n.d(e,"createStore",function(){return u}),n.d(e,"combineReducers",function(){return c}),n.d(e,"bindActionCreators",function(){return p}),n.d(e,"applyMiddleware",function(){return d}),n.d(e,"compose",function(){return f}),n.d(e,"__DO_NOT_USE__ActionTypes",function(){return r});var i=n(79),r={INIT:"@@redux/INIT"+Math.random().toString(36).substring(7).split("").join("."),REPLACE:"@@redux/REPLACE"+Math.random().toString(36).substring(7).split("").join(".")},o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s=Object.assign||function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{},e=arguments[1];if(a)throw a;for(var i=!1,r={},o=0;o0&&void 0!==arguments[0]?arguments[0]:"store",n=arguments[1]||e+"Subscription",r=function(t){function r(n,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,i));return o[e]=n.store,o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(r,t),r.prototype.getChildContext=function(){var t;return(t={})[e]=this[e],t[n]=null,t},r.prototype.render=function(){return i.a.only(this.props.children)},r}(i.b);return r.propTypes={store:a.isRequired,children:o.a.element.isRequired},r.childContextTypes=((t={})[e]=a.isRequired,t[n]=s,t),r}var l=u(),c=n(51),h=n.n(c),p=n(8),f=n.n(p);var d=null,y={notify:function(){}};var m=function(){function t(e,n,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.store=e,this.parentSub=n,this.onStateChange=i,this.unsubscribe=null,this.listeners=y}return t.prototype.addNestedSub=function(t){return this.trySubscribe(),this.listeners.subscribe(t)},t.prototype.notifyNestedSubs=function(){this.listeners.notify()},t.prototype.isSubscribed=function(){return Boolean(this.unsubscribe)},t.prototype.trySubscribe=function(){var t,e;this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.onStateChange):this.store.subscribe(this.onStateChange),this.listeners=(t=[],e=[],{clear:function(){e=d,t=d},notify:function(){for(var n=t=e,i=0;i1&&void 0!==arguments[1]?arguments[1]:{},o=r.getDisplayName,u=void 0===o?function(t){return"ConnectAdvanced("+t+")"}:o,l=r.methodName,c=void 0===l?"connectAdvanced":l,p=r.renderCountProp,d=void 0===p?void 0:p,y=r.shouldHandleStateChanges,w=void 0===y||y,S=r.storeKey,k=void 0===S?"store":S,T=r.withRef,x=void 0!==T&&T,O=function(t,e){var n={};for(var i in t)e.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n}(r,["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef"]),P=k+"Subscription",A=v++,E=((e={})[k]=a,e[P]=s,e),C=((n={})[P]=s,n);return function(e){f()("function"==typeof e,"You must pass a component to the function returned by "+c+". Instead received "+JSON.stringify(e));var n=e.displayName||e.name||"Component",r=u(n),o=_({},O,{getDisplayName:u,methodName:c,renderCountProp:d,shouldHandleStateChanges:w,storeKey:k,withRef:x,displayName:r,wrappedComponentName:n,WrappedComponent:e}),s=function(n){function s(t,e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s);var i=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,n.call(this,t,e));return i.version=A,i.state={},i.renderCount=0,i.store=t[k]||e[k],i.propsMode=Boolean(t[k]),i.setWrappedInstance=i.setWrappedInstance.bind(i),f()(i.store,'Could not find "'+k+'" in either the context or props of "'+r+'". Either wrap the root component in a , or explicitly pass "'+k+'" as a prop to "'+r+'".'),i.initSelector(),i.initSubscription(),i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(s,n),s.prototype.getChildContext=function(){var t,e=this.propsMode?null:this.subscription;return(t={})[P]=e||this.context[P],t},s.prototype.componentDidMount=function(){w&&(this.subscription.trySubscribe(),this.selector.run(this.props),this.selector.shouldComponentUpdate&&this.forceUpdate())},s.prototype.componentWillReceiveProps=function(t){this.selector.run(t)},s.prototype.shouldComponentUpdate=function(){return this.selector.shouldComponentUpdate},s.prototype.componentWillUnmount=function(){this.subscription&&this.subscription.tryUnsubscribe(),this.subscription=null,this.notifyNestedSubs=b,this.store=null,this.selector.run=b,this.selector.shouldComponentUpdate=!1},s.prototype.getWrappedInstance=function(){return f()(x,"To access the wrapped instance, you need to specify { withRef: true } in the options argument of the "+c+"() call."),this.wrappedInstance},s.prototype.setWrappedInstance=function(t){this.wrappedInstance=t},s.prototype.initSelector=function(){var e=t(this.store.dispatch,o);this.selector=function(t,e){var n={run:function(i){try{var r=t(e.getState(),i);(r!==n.props||n.error)&&(n.shouldComponentUpdate=!0,n.props=r,n.error=null)}catch(t){n.shouldComponentUpdate=!0,n.error=t}}};return n}(e,this.store),this.selector.run(this.props)},s.prototype.initSubscription=function(){if(w){var t=(this.propsMode?this.props:this.context)[P];this.subscription=new m(this.store,t,this.onStateChange.bind(this)),this.notifyNestedSubs=this.subscription.notifyNestedSubs.bind(this.subscription)}},s.prototype.onStateChange=function(){this.selector.run(this.props),this.selector.shouldComponentUpdate?(this.componentDidUpdate=this.notifyNestedSubsOnComponentDidUpdate,this.setState(g)):this.notifyNestedSubs()},s.prototype.notifyNestedSubsOnComponentDidUpdate=function(){this.componentDidUpdate=void 0,this.notifyNestedSubs()},s.prototype.isSubscribed=function(){return Boolean(this.subscription)&&this.subscription.isSubscribed()},s.prototype.addExtraProps=function(t){if(!(x||d||this.propsMode&&this.subscription))return t;var e=_({},t);return x&&(e.ref=this.setWrappedInstance),d&&(e[d]=this.renderCount++),this.propsMode&&this.subscription&&(e[P]=this.subscription),e},s.prototype.render=function(){var t=this.selector;if(t.shouldComponentUpdate=!1,t.error)throw t.error;return Object(i.c)(e,this.addExtraProps(t.props))},s}(i.b);return s.WrappedComponent=e,s.displayName=r,s.childContextTypes=C,s.contextTypes=E,s.propTypes=E,h()(s,e)}}var S=Object.prototype.hasOwnProperty;function k(t,e){return t===e?0!==t||0!==e||1/t==1/e:t!=t&&e!=e}function T(t,e){if(k(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;var n=Object.keys(t),i=Object.keys(e);if(n.length!==i.length)return!1;for(var r=0;r=0||Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n}(e,["initMapStateToProps","initMapDispatchToProps","initMergeProps"]),s=n(t,o),a=i(t,o),u=r(t,o);return(o.pure?z:U)(s,a,u,t,o)}var W=Object.assign||function(t){for(var e=1;e=0;i--){var r=e[i](t);if(r)return r}return function(e,i){throw new Error("Invalid value of type "+typeof t+" for "+n+" argument when connecting component "+i.wrappedComponentName+".")}}function G(t,e){return t===e}var H=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.connectHOC,n=void 0===e?w:e,i=t.mapStateToPropsFactories,r=void 0===i?L:i,o=t.mapDispatchToPropsFactories,s=void 0===o?D:o,a=t.mergePropsFactories,u=void 0===a?B:a,l=t.selectorFactory,c=void 0===l?Y:l;return function(t,e,i){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=o.pure,l=void 0===a||a,h=o.areStatesEqual,p=void 0===h?G:h,f=o.areOwnPropsEqual,d=void 0===f?T:f,y=o.areStatePropsEqual,m=void 0===y?T:y,_=o.areMergedPropsEqual,v=void 0===_?T:_,g=function(t,e){var n={};for(var i in t)e.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n}(o,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),b=V(t,r,"mapStateToProps"),w=V(e,s,"mapDispatchToProps"),S=V(i,u,"mergeProps");return n(c,W({methodName:"connect",getDisplayName:function(t){return"Connect("+t+")"},shouldHandleStateChanges:Boolean(t),initMapStateToProps:b,initMapDispatchToProps:w,initMergeProps:S,pure:l,areStatesEqual:p,areOwnPropsEqual:d,areStatePropsEqual:m,areMergedPropsEqual:v},g))}}();n.d(e,"Provider",function(){return l}),n.d(e,"createProvider",function(){return u}),n.d(e,"connectAdvanced",function(){return w}),n.d(e,"connect",function(){return H})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(73);e.default={system:{load_site:"SYSTEM_LOAD_SITE",running_command:"SYSTEM_RUNNING_COMMAND",command_output:"SYSTEM_COMMAND_OUTPUT",relay_connected:"SYSTEM_RELAY_CONNECTED",relay_disconnected:"SYSTEM_RELAY_DISCONNECTED",rpc_connected:"SYSTEM_RPC_CONNECTED",rpc_disconnected:"SYSTEM_RPC_DISCONNECTED",list_directory:"SYSTEM_LIST_DIRECTORY",listing_directory:"SYSTEM_LISTING_DIRECTORY",stdout:"SYSTEM_STDOUT",stderr:"SYSTEM_STDERR"},app:{change_tool:"APP_CHANGE_TOOL",load_progress:"APP_LOAD_PROGRESS"},folder:(0,i.crud_type)("folder",[]),file:(0,i.crud_type)("file",[]),task:(0,i.crud_type)("task",["starting_task","stopping_task","task_begin","task_finish","start_queue","stop_queue","starting_queue","stopping_queue","progress","epoch"]),socket:{connect:"SOCKET_CONNECT",connect_error:"SOCKET_CONNECT_ERROR",reconnect:"SOCKET_RECONNECT",reconnecting:"SOCKET_RECONNECTING",reconnect_error:"SOCKET_RECONNECT_ERROR",reconnect_failed:"SOCKET_RECONNECT_FAILED",disconnect:"SOCKET_DISCONNECT",error:"SOCKET_ERROR",status:"SOCKET_STATUS",load_params:"SOCKET_LOAD_PARAMS",list_checkpoints:"SOCKET_LIST_CHECKPOINTS",list_sequences:"SOCKET_LIST_SEQUENCES",list_epochs:"SOCKET_LIST_EPOCHS"},player:{get_params:"GET_PARAMS",set_param:"SET_PARAM",loading_checkpoints:"LOADING_CHECKPOINTS",loading_checkpoint:"LOADING_CHECKPOINT",list_checkpoints:"LIST_CHECKPOINTS",loading_sequences:"LOADING_SEQUENCES",loading_sequence:"LOADING_SEQUENCE",load_sequence:"LOAD_SEQUENCE",loading_epochs:"LOADING_EPOCHS",load_epoch:"LOAD_EPOCH",set_fps:"SET_FPS",seeking:"SEEKING",pausing:"PAUSING",playing:"PLAYING",current_frame:"CURRENT_FRAME",start_recording:"START_RECORDING",add_record_frame:"ADD_RECORD_FRAME",save_frame:"SAVE_FRAME",saving_video:"SAVING_VIDEO",save_video:"SAVE_VIDEO"},audioPlayer:{play:"AUDIO_PLAY",pause:"AUDIO_PAUSE",resume:"AUDIO_RESUME",enqueue:"AUDIO_ENQUEUE"},dataset:{load:"DATASET_LOAD",set_folder:"DATASET_SET_FOLDER",upload_files:"DATASET_UPLOAD_FILES",file_progress:"DATASET_FILE_PROGRESS",file_uploaded:"DATASET_FILE_UPLOADED",fetch_url:"DATASET_FETCH_URL",fetch_progress:"DATASET_FETCH_PROGRESS"},samplernn:{init:"SAMPLERNN_INIT",set_folder:"SAMPLERNN_SET_FOLDER",load_loss:"SAMPLERNN_LOAD_LOSS",load_graph:"SAMPLERNN_LOAD_GRAPH"},pix2pix:(0,i.with_type)("pix2pix",["init","set_folder"]),pix2wav:(0,i.with_type)("pix2wav",["init","set_folder"]),wav2pix:(0,i.with_type)("wav2pix",["load","progress","finish","zip","uploading"]),dashboard:(0,i.with_type)("dashboard",["load"])}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=Object.assign||function(t){for(var e=1;e1;)try{return c.stringifyByChunk(t,i,n)}catch(t){n=Math.floor(n/2)}return c.stringifyByChar(t)}function p(t,e){for(var n=0;n may have only one child element"),this.unlisten=i.listen(function(){t.setState({match:t.computeMatch(i.location.pathname)})})},e.prototype.componentWillReceiveProps=function(t){r()(this.props.history===t.history,"You cannot change ")},e.prototype.componentWillUnmount=function(){this.unlisten()},e.prototype.render=function(){var t=this.props.children;return t?o.d.Children.only(t):null},e}(o.d.Component);d.propTypes={history:a.a.object.isRequired,children:a.a.node},d.contextTypes={router:a.a.object},d.childContextTypes={router:a.a.object.isRequired};var y=d,m=y;function _(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var v=function(t){function e(){var n,i;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);for(var r=arguments.length,o=Array(r),s=0;s ignores the history prop. To use a custom history, use `import { Router }` instead of `import { BrowserRouter as Router }`.")},e.prototype.render=function(){return o.d.createElement(m,{history:this.history,children:this.props.children})},e}(o.d.Component);v.propTypes={basename:a.a.string,forceRefresh:a.a.bool,getUserConfirmation:a.a.func,keyLength:a.a.number,children:a.a.node};var g=v,b=n(126),w=n.n(b);function S(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var k=function(t){function e(){var n,i;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);for(var r=arguments.length,o=Array(r),s=0;s ignores the history prop. To use a custom history, use `import { Router }` instead of `import { HashRouter as Router }`.")},e.prototype.render=function(){return o.d.createElement(m,{history:this.history,children:this.props.children})},e}(o.d.Component);k.propTypes={basename:a.a.string,getUserConfirmation:a.a.func,hashType:a.a.oneOf(["hashbang","noslash","slash"]),children:a.a.node};var T=k,x=Object.assign||function(t){for(var e=1;e=0||Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n}(t,["replace","to","innerRef"]);h()(this.context.router,"You should not use outside a ");var r=this.context.router.history.createHref("string"==typeof e?{pathname:e}:e);return o.d.createElement("a",x({},i,{onClick:this.handleClick,href:r,ref:n}))},e}(o.d.Component);A.propTypes={onClick:a.a.func,target:a.a.string,replace:a.a.bool,to:a.a.oneOfType([a.a.string,a.a.object]).isRequired,innerRef:a.a.oneOfType([a.a.string,a.a.func])},A.defaultProps={replace:!1},A.contextTypes={router:a.a.shape({history:a.a.shape({push:a.a.func.isRequired,replace:a.a.func.isRequired,createHref:a.a.func.isRequired}).isRequired}).isRequired};var E=A,C=n(125),M=n.n(C);function R(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var j=function(t){function e(){var n,i;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);for(var r=arguments.length,o=Array(r),s=0;s ignores the history prop. To use a custom history, use `import { Router }` instead of `import { MemoryRouter as Router }`.")},e.prototype.render=function(){return o.d.createElement(y,{history:this.history,children:this.props.children})},e}(o.d.Component);j.propTypes={initialEntries:a.a.array,initialIndex:a.a.number,getUserConfirmation:a.a.func,keyLength:a.a.number,children:a.a.node};var F=j,N=n(124),D=n.n(N),L={},q=0,I=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"==typeof e&&(e={path:e});var n=e,i=n.path,r=void 0===i?"/":i,o=n.exact,s=void 0!==o&&o,a=n.strict,u=void 0!==a&&a,l=n.sensitive,c=function(t,e){var n=""+e.end+e.strict+e.sensitive,i=L[n]||(L[n]={});if(i[t])return i[t];var r=[],o={re:D()(t,r,e),keys:r};return q<1e4&&(i[t]=o,q++),o}(r,{end:s,strict:u,sensitive:void 0!==l&&l}),h=c.re,p=c.keys,f=h.exec(t);if(!f)return null;var d=f[0],y=f.slice(1),m=t===d;return s&&!m?null:{path:r,url:"/"===r&&""===d?"/":d,isExact:m,params:p.reduce(function(t,e,n){return t[e.name]=y[n],t},{})}},B=Object.assign||function(t){for(var e=1;e or withRouter() outside a ");var u=e.route,l=(i||u.location).pathname;return r?I(l,{path:r,strict:o,exact:s,sensitive:a}):u.match},e.prototype.componentWillMount=function(){r()(!(this.props.component&&this.props.render),"You should not use and in the same route; will be ignored"),r()(!(this.props.component&&this.props.children&&!z(this.props.children)),"You should not use and in the same route; will be ignored"),r()(!(this.props.render&&this.props.children&&!z(this.props.children)),"You should not use and in the same route; will be ignored")},e.prototype.componentWillReceiveProps=function(t,e){r()(!(t.location&&!this.props.location),' elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.'),r()(!(!t.location&&this.props.location),' elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.'),this.setState({match:this.computeMatch(t,e.router)})},e.prototype.render=function(){var t=this.state.match,e=this.props,n=e.children,i=e.component,r=e.render,s=this.context.router,a=s.history,u=s.route,l=s.staticContext,c={match:t,location:this.props.location||u.location,history:a,staticContext:l};return i?t?o.d.createElement(i,c):null:r?t?r(c):null:n?"function"==typeof n?n(c):z(n)?null:o.d.Children.only(n):null},e}(o.d.Component);Y.propTypes={computedMatch:a.a.object,path:a.a.string,exact:a.a.bool,strict:a.a.bool,sensitive:a.a.bool,component:a.a.func,render:a.a.func,children:a.a.oneOfType([a.a.func,a.a.node]),location:a.a.object},Y.contextTypes={router:a.a.shape({history:a.a.object.isRequired,route:a.a.object.isRequired,staticContext:a.a.object})},Y.childContextTypes={router:a.a.object.isRequired};var W=Y,V=W,G=Object.assign||function(t){for(var e=1;e=0||Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n}(t,["to","exact","strict","location","activeClassName","className","activeStyle","style","isActive","ariaCurrent"]);return o.d.createElement(V,{path:"object"===(void 0===e?"undefined":H(e))?e.pathname:e,exact:n,strict:i,location:r,children:function(t){var n=t.location,i=t.match,r=!!(c?c(i,n):i);return o.d.createElement(E,G({to:e,className:r?[a,s].filter(function(t){return t}).join(" "):a,style:r?G({},l,u):l,"aria-current":r&&h},p))}})};Z.propTypes={to:E.propTypes.to,exact:a.a.bool,strict:a.a.bool,location:a.a.object,activeClassName:a.a.string,className:a.a.string,activeStyle:a.a.object,style:a.a.object,isActive:a.a.func,ariaCurrent:a.a.oneOf(["page","step","location","true"])},Z.defaultProps={activeClassName:"active",ariaCurrent:"true"};var Q=Z;var X=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.enable=function(t){this.unblock&&this.unblock(),this.unblock=this.context.router.history.block(t)},e.prototype.disable=function(){this.unblock&&(this.unblock(),this.unblock=null)},e.prototype.componentWillMount=function(){h()(this.context.router,"You should not use outside a "),this.props.when&&this.enable(this.props.message)},e.prototype.componentWillReceiveProps=function(t){t.when?this.props.when&&this.props.message===t.message||this.enable(t.message):this.disable()},e.prototype.componentWillUnmount=function(){this.disable()},e.prototype.render=function(){return null},e}(o.d.Component);X.propTypes={when:a.a.bool,message:a.a.oneOfType([a.a.func,a.a.string]).isRequired},X.defaultProps={when:!0},X.contextTypes={router:a.a.shape({history:a.a.shape({block:a.a.func.isRequired}).isRequired}).isRequired};var $=X,K=n(77),J=n(76),tt=Object.assign||function(t){for(var e=1;e outside a "),this.isStatic()&&this.perform()},e.prototype.componentDidMount=function(){this.isStatic()||this.perform()},e.prototype.componentDidUpdate=function(t){var e=et(t.to),n=et(this.props.to);nt(e,n)?r()(!1,"You tried to redirect to the same route you're currently on: \""+n.pathname+n.search+'"'):this.perform()},e.prototype.perform=function(){var t=this.context.router.history,e=this.props,n=e.push,i=e.to;n?t.push(i):t.replace(i)},e.prototype.render=function(){return null},e}(o.d.Component);it.propTypes={push:a.a.bool,from:a.a.string,to:a.a.oneOfType([a.a.string,a.a.object]).isRequired},it.defaultProps={push:!1},it.contextTypes={router:a.a.shape({history:a.a.shape({push:a.a.func.isRequired,replace:a.a.func.isRequired}).isRequired,staticContext:a.a.object}).isRequired};var rt=it,ot=n(14),st=Object.assign||function(t){for(var e=1;e",t)}},pt=function(){},ft=function(t){function e(){var n,i;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);for(var r=arguments.length,o=Array(r),s=0;s ignores the history prop. To use a custom history, use `import { Router }` instead of `import { StaticRouter as Router }`.")},e.prototype.render=function(){var t=this.props,e=t.basename,n=(t.context,t.location),i=function(t,e){var n={};for(var i in t)e.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n}(t,["basename","context","location"]),r={createHref:this.createHref,action:"POP",location:function(t,e){if(!t)return e;var n=Object(ot.addLeadingSlash)(t);return 0!==e.pathname.indexOf(n)?e:st({},e,{pathname:e.pathname.substr(n.length)})}(e,lt(n)),push:this.handlePush,replace:this.handleReplace,go:ht("go"),goBack:ht("goBack"),goForward:ht("goForward"),listen:this.handleListen,block:this.handleBlock};return o.d.createElement(y,st({},i,{history:r}))},e}(o.d.Component);ft.propTypes={basename:a.a.string,context:a.a.object.isRequired,location:a.a.oneOfType([a.a.string,a.a.object])},ft.defaultProps={basename:"",location:"/"},ft.childContextTypes={router:a.a.object.isRequired};var dt=ft;var yt=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.componentWillMount=function(){h()(this.context.router,"You should not use outside a ")},e.prototype.componentWillReceiveProps=function(t){r()(!(t.location&&!this.props.location),' elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.'),r()(!(!t.location&&this.props.location),' elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.')},e.prototype.render=function(){var t=this.context.router.route,e=this.props.children,n=this.props.location||t.location,i=void 0,r=void 0;return o.d.Children.forEach(e,function(e){if(o.d.isValidElement(e)){var s=e.props,a=s.path,u=s.exact,l=s.strict,c=s.sensitive,h=s.from,p=a||h;null==i&&(r=e,i=p?I(n.pathname,{path:p,exact:u,strict:l,sensitive:c}):t.match)}}),i?o.d.cloneElement(r,{location:n,computedMatch:i}):null},e}(o.d.Component);yt.contextTypes={router:a.a.shape({route:a.a.object.isRequired}).isRequired},yt.propTypes={children:a.a.node,location:a.a.object};var mt=yt,_t=I,vt=n(51),gt=n.n(vt),bt=Object.assign||function(t){for(var e=1;e=0||Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n}(e,["wrappedComponentRef"]);return o.d.createElement(W,{render:function(e){return o.d.createElement(t,bt({},i,e,{ref:n}))}})};return e.displayName="withRouter("+(t.displayName||t.name)+")",e.WrappedComponent=t,e.propTypes={wrappedComponentRef:a.a.func},gt()(e,t)};n.d(e,"BrowserRouter",function(){return g}),n.d(e,"HashRouter",function(){return T}),n.d(e,"Link",function(){return E}),n.d(e,"MemoryRouter",function(){return F}),n.d(e,"NavLink",function(){return Q}),n.d(e,"Prompt",function(){return $}),n.d(e,"Redirect",function(){return rt}),n.d(e,"Route",function(){return V}),n.d(e,"Router",function(){return m}),n.d(e,"StaticRouter",function(){return dt}),n.d(e,"Switch",function(){return mt}),n.d(e,"matchPath",function(){return _t}),n.d(e,"withRouter",function(){return wt})},function(t,e,n){"use strict";function i(t){this.name=t||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(t){this.emit("data",t)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(t){this.emit("error",t)}return!0},error:function(t){return!this.isFinished&&(this.isPaused?this.generatedError=t:(this.isFinished=!0,this.emit("error",t),this.previous&&this.previous.error(t),this.cleanUp()),!0)},on:function(t,e){return this._listeners[t].push(e),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(t,e){if(this._listeners[t])for(var n=0;n "+t:t}},t.exports=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,r=Object.assign||function(t){for(var e=1;ea)&&void 0===t.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=d,u=y,r=p;var _=(1e4*(268435455&(d+=122192928e5))+y)%4294967296;c[l++]=_>>>24&255,c[l++]=_>>>16&255,c[l++]=_>>>8&255,c[l++]=255&_;var v=d/4294967296*1e4&268435455;c[l++]=v>>>8&255,c[l++]=255&v,c[l++]=v>>>24&15|16,c[l++]=v>>>16&255,c[l++]=p>>>8|128,c[l++]=255&p;for(var g=0;g<6;++g)c[l+g]=h[g];return e||s(c)}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e,n){"use strict";for(var i=n(9),r=n(18),o=n(40),s=n(12),a=new Array(256),u=0;u<256;u++)a[u]=u>=252?6:u>=248?5:u>=240?4:u>=224?3:u>=192?2:1;a[254]=a[254]=1;function l(){s.call(this,"utf-8 decode"),this.leftOver=null}function c(){s.call(this,"utf-8 encode")}e.utf8encode=function(t){return r.nodebuffer?o.newBufferFrom(t,"utf-8"):function(t){var e,n,i,o,s,a=t.length,u=0;for(o=0;o>>6,e[s++]=128|63&n):n<65536?(e[s++]=224|n>>>12,e[s++]=128|n>>>6&63,e[s++]=128|63&n):(e[s++]=240|n>>>18,e[s++]=128|n>>>12&63,e[s++]=128|n>>>6&63,e[s++]=128|63&n);return e}(t)},e.utf8decode=function(t){return r.nodebuffer?i.transformTo("nodebuffer",t).toString("utf-8"):function(t){var e,n,r,o,s=t.length,u=new Array(2*s);for(n=0,e=0;e4)u[n++]=65533,e+=o-1;else{for(r&=2===o?31:3===o?15:7;o>1&&e1?u[n++]=65533:r<65536?u[n++]=r:(r-=65536,u[n++]=55296|r>>10&1023,u[n++]=56320|1023&r)}return u.length!==n&&(u.subarray?u=u.subarray(0,n):u.length=n),i.applyFromCharCode(u)}(t=i.transformTo(r.uint8array?"uint8array":"array",t))},i.inherits(l,s),l.prototype.processChunk=function(t){var n=i.transformTo(r.uint8array?"uint8array":"array",t.data);if(this.leftOver&&this.leftOver.length){if(r.uint8array){var o=n;(n=new Uint8Array(o.length+this.leftOver.length)).set(this.leftOver,0),n.set(o,this.leftOver.length)}else n=this.leftOver.concat(n);this.leftOver=null}var s=function(t,e){var n;for((e=e||t.length)>t.length&&(e=t.length),n=e-1;n>=0&&128==(192&t[n]);)n--;return n<0?e:0===n?e:n+a[t[n]]>e?n:e}(n),u=n;s!==n.length&&(r.uint8array?(u=n.subarray(0,s),this.leftOver=n.subarray(s,n.length)):(u=n.slice(0,s),this.leftOver=n.slice(s,n.length))),this.push({data:e.utf8decode(u),meta:t.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:e.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},e.Utf8DecodeWorker=l,i.inherits(c,s),c.prototype.processChunk=function(t){this.push({data:e.utf8encode(t.data),meta:t.meta})},e.Utf8EncodeWorker=c},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FileRow=e.FileList=void 0;var i=n(1),r=(n(4),n(5),n(11),s(n(29))),o=s(n(7));function s(t){return t&&t.__esModule?t:{default:t}}var a=o.default.fieldSet(new Set(["name","date","size"])),u=(e.FileList=function(t){var e=t.files,n=t.fields,r=(t.sort,t.title),s=t.linkFiles,l=t.onClick,c=t.onDelete,h=t.orderBy,p=void 0===h?"name asc":h,f=t.className,d=void 0===f?"":f,y=t.fileListClassName,m=void 0===y?"filelist":y,_=t.rowClassName,v=void 0===_?"row file":_,g=o.default.sort.orderByFn(p),b=g.mapFn,w=g.sortFn,S=(e||[]).filter(function(t){return!!t}).map(b).sort(w).map(function(t){return(0,i.h)(u,{file:t[1],fields:a(n),className:v,linkFiles:s,onDelete:c,onClick:l})});return S&&S.length?(0,i.h)("div",{className:"rows "+d},r&&(0,i.h)("div",{class:"row heading"},(0,i.h)("h3",null,r),"}"),(0,i.h)("div",{className:"rows "+m},S)):(0,i.h)("div",{className:"rows "+d},(0,i.h)("div",{class:"row heading"},(0,i.h)("h4",{class:"noFiles"},"No files")))},e.FileRow=function(t){var e=t.file,n=t.linkFiles,s=t.onDelete,u=t.onClick,l=t.className,c=void 0===l?"row file":l,h=t.username,p=void 0===h?"":h,f=a(t.fields),d=o.default.hush_size(e.size),y=e.date||e.created_at,m=e.epoch||e.epochs||0,_=void 0,v=void 0;return e.name?v=_=e.name:e.url&&(e.opt&&e.opt.type?(_=e.opt.type+": "+e.opt.title,v=e.opt.token):v=_=e.url.replace(/^https?:\/\//,"")),(0,i.h)("div",{class:c,key:v},f.has("name")&&(0,i.h)("div",{className:"filename",title:e.name||e.url},!1===e.persisted?(0,i.h)("span",{className:"unpersisted"},_):n&&e.url?(0,i.h)("a",{target:"_blank",onClick:function(t){t.metaKey||t.ctrlKey||t.altKey||(t.preventDefault(),u&&u(e,t))},href:e.url},_):(0,i.h)("span",{class:"link",onClick:function(t){return u&&u(e,t)}},_)),f.has("age")&&(0,i.h)("div",{className:"age "+o.default.carbon_date(y)},o.default.get_age(y)),f.has("username")&&(0,i.h)("div",{className:"username"},p),f.has("epoch")&&(0,i.h)("div",{className:"epoch "+o.default.hush_null(m)[0]},m>0?"ep. "+m:""),f.has("date")&&(0,i.h)("div",{className:"date "+o.default.carbon_date(y)},(0,r.default)(y).format("YYYY-MM-DD")),f.has("datetime")&&(0,i.h)("div",{className:"datetime "+o.default.carbon_date(y)},(0,r.default)(y).format("YYYY-MM-DD h:mm a")),f.has("size")&&(0,i.h)("div",{className:"size "+d[0]},d[1]),(f.has("activity")||f.has("module"))&&(0,i.h)("div",{className:"activity"},f.has("activity")&&e.activity,f.has("module")&&e.module),f.has("delete")&&s&&e.id&&(0,i.h)("div",{className:"destroy",onClick:function(t){return s(e)}},"x"),t.options&&t.options(e))})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.socket=void 0;var i,r=n(15),o=n(6),s=(i=o)&&i.__esModule?i:{default:i};var a=e.socket=io.connect("/client");a.on("connect",function(){return r.store.dispatch({type:s.default.socket.connect})}),a.on("connect_error",function(t){return r.store.dispatch({type:s.default.socket.connect_error,error:t})}),a.on("reconnect",function(t){return r.store.dispatch({type:s.default.socket.reconnect,attempt:t})}),a.on("reconnecting",function(){return r.store.dispatch({type:s.default.socket.reconnecting})}),a.on("reconnect_error",function(t){return r.store.dispatch({type:s.default.socket.reconnect_error,error:t})}),a.on("reconnect_failed",function(t){return r.store.dispatch({type:s.default.socket.reconnect_failed,error:t})}),a.on("disconnect",function(){return r.store.dispatch({type:s.default.socket.disconnect})}),a.on("error",function(t){return r.store.dispatch({type:s.default.socket.error,error:t})})},function(t,e,n){(function(t){t.exports=function(){"use strict";var e,n;function i(){return e.apply(null,arguments)}function r(t){return t instanceof Array||"[object Array]"===Object.prototype.toString.call(t)}function o(t){return null!=t&&"[object Object]"===Object.prototype.toString.call(t)}function s(t){return void 0===t}function a(t){return"number"==typeof t||"[object Number]"===Object.prototype.toString.call(t)}function u(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function l(t,e){var n,i=[];for(n=0;n>>0,i=0;iTt(t)?(o=t+1,s=a-Tt(t)):(o=t,s=a),{year:o,dayOfYear:s}}function Yt(t,e,n){var i,r,o=Ut(t.year(),e,n),s=Math.floor((t.dayOfYear()-o-1)/7)+1;return s<1?i=s+Wt(r=t.year()-1,e,n):s>Wt(t.year(),e,n)?(i=s-Wt(t.year(),e,n),r=t.year()+1):(r=t.year(),i=s),{week:i,year:r}}function Wt(t,e,n){var i=Ut(t,e,n),r=Ut(t+1,e,n);return(Tt(t)-i+r)/7}Y("w",["ww",2],"wo","week"),Y("W",["WW",2],"Wo","isoWeek"),j("week","w"),j("isoWeek","W"),L("week",5),L("isoWeek",5),lt("w",$),lt("ww",$,H),lt("W",$),lt("WW",$,H),dt(["w","ww","W","WW"],function(t,e,n,i){e[i.substr(0,1)]=S(t)}),Y("d",0,"do","day"),Y("dd",0,0,function(t){return this.localeData().weekdaysMin(this,t)}),Y("ddd",0,0,function(t){return this.localeData().weekdaysShort(this,t)}),Y("dddd",0,0,function(t){return this.localeData().weekdays(this,t)}),Y("e",0,0,"weekday"),Y("E",0,0,"isoWeekday"),j("day","d"),j("weekday","e"),j("isoWeekday","E"),L("day",11),L("weekday",11),L("isoWeekday",11),lt("d",$),lt("e",$),lt("E",$),lt("dd",function(t,e){return e.weekdaysMinRegex(t)}),lt("ddd",function(t,e){return e.weekdaysShortRegex(t)}),lt("dddd",function(t,e){return e.weekdaysRegex(t)}),dt(["dd","ddd","dddd"],function(t,e,n,i){var r=n._locale.weekdaysParse(t,i,n._strict);null!=r?e.d=r:f(n).invalidWeekday=t}),dt(["d","e","E"],function(t,e,n,i){e[i]=S(t)});var Vt="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Gt="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Ht="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Zt=at,Qt=at,Xt=at;function $t(){function t(t,e){return e.length-t.length}var e,n,i,r,o,s=[],a=[],u=[],l=[];for(e=0;e<7;e++)n=p([2e3,1]).day(e),i=this.weekdaysMin(n,""),r=this.weekdaysShort(n,""),o=this.weekdays(n,""),s.push(i),a.push(r),u.push(o),l.push(i),l.push(r),l.push(o);for(s.sort(t),a.sort(t),u.sort(t),l.sort(t),e=0;e<7;e++)a[e]=ht(a[e]),u[e]=ht(u[e]),l[e]=ht(l[e]);this._weekdaysRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+s.join("|")+")","i")}function Kt(){return this.hours()%12||12}function Jt(t,e){Y(t,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}function te(t,e){return e._meridiemParse}Y("H",["HH",2],0,"hour"),Y("h",["hh",2],0,Kt),Y("k",["kk",2],0,function(){return this.hours()||24}),Y("hmm",0,0,function(){return""+Kt.apply(this)+q(this.minutes(),2)}),Y("hmmss",0,0,function(){return""+Kt.apply(this)+q(this.minutes(),2)+q(this.seconds(),2)}),Y("Hmm",0,0,function(){return""+this.hours()+q(this.minutes(),2)}),Y("Hmmss",0,0,function(){return""+this.hours()+q(this.minutes(),2)+q(this.seconds(),2)}),Jt("a",!0),Jt("A",!1),j("hour","h"),L("hour",13),lt("a",te),lt("A",te),lt("H",$),lt("h",$),lt("k",$),lt("HH",$,H),lt("hh",$,H),lt("kk",$,H),lt("hmm",K),lt("hmmss",J),lt("Hmm",K),lt("Hmmss",J),ft(["H","HH"],vt),ft(["k","kk"],function(t,e,n){var i=S(t);e[vt]=24===i?0:i}),ft(["a","A"],function(t,e,n){n._isPm=n._locale.isPM(t),n._meridiem=t}),ft(["h","hh"],function(t,e,n){e[vt]=S(t),f(n).bigHour=!0}),ft("hmm",function(t,e,n){var i=t.length-2;e[vt]=S(t.substr(0,i)),e[gt]=S(t.substr(i)),f(n).bigHour=!0}),ft("hmmss",function(t,e,n){var i=t.length-4,r=t.length-2;e[vt]=S(t.substr(0,i)),e[gt]=S(t.substr(i,2)),e[bt]=S(t.substr(r)),f(n).bigHour=!0}),ft("Hmm",function(t,e,n){var i=t.length-2;e[vt]=S(t.substr(0,i)),e[gt]=S(t.substr(i))}),ft("Hmmss",function(t,e,n){var i=t.length-4,r=t.length-2;e[vt]=S(t.substr(0,i)),e[gt]=S(t.substr(i,2)),e[bt]=S(t.substr(r))});var ee,ne=At("Hours",!0),ie={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:jt,monthsShort:Ft,week:{dow:0,doy:6},weekdays:Vt,weekdaysMin:Ht,weekdaysShort:Gt,meridiemParse:/[ap]\.?m?\.?/i},re={},oe={};function se(t){return t?t.toLowerCase().replace("_","-"):t}function ae(e){var n=null;if(!re[e]&&void 0!==t&&t&&t.exports)try{n=ee._abbr,function(){var t=new Error('Cannot find module "undefined"');throw t.code="MODULE_NOT_FOUND",t}(),ue(n)}catch(e){}return re[e]}function ue(t,e){var n;return t&&((n=s(e)?ce(t):le(t,e))?ee=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+t+" not found. Did you forget to load it?")),ee._abbr}function le(t,e){if(null!==e){var n,i=ie;if(e.abbr=t,null!=re[t])A("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),i=re[t]._config;else if(null!=e.parentLocale)if(null!=re[e.parentLocale])i=re[e.parentLocale]._config;else{if(null==(n=ae(e.parentLocale)))return oe[e.parentLocale]||(oe[e.parentLocale]=[]),oe[e.parentLocale].push({name:t,config:e}),null;i=n._config}return re[t]=new M(C(i,e)),oe[t]&&oe[t].forEach(function(t){le(t.name,t.config)}),ue(t),re[t]}return delete re[t],null}function ce(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return ee;if(!r(t)){if(e=ae(t))return e;t=[t]}return function(t){for(var e,n,i,r,o=0;o=e&&k(r,n,!0)>=e-1)break;e--}o++}return ee}(t)}function he(t){var e,n=t._a;return n&&-2===f(t).overflow&&(e=n[mt]<0||11Mt(n[yt],n[mt])?_t:n[vt]<0||24Wt(n,o,s)?f(t)._overflowWeeks=!0:null!=u?f(t)._overflowWeekday=!0:(a=zt(n,i,r,o,s),t._a[yt]=a.year,t._dayOfYear=a.dayOfYear)}(t),null!=t._dayOfYear&&(s=pe(t._a[yt],r[yt]),(t._dayOfYear>Tt(s)||0===t._dayOfYear)&&(f(t)._overflowDayOfYear=!0),n=Bt(s,0,t._dayOfYear),t._a[mt]=n.getUTCMonth(),t._a[_t]=n.getUTCDate()),e=0;e<3&&null==t._a[e];++e)t._a[e]=a[e]=r[e];for(;e<7;e++)t._a[e]=a[e]=null==t._a[e]?2===e?1:0:t._a[e];24===t._a[vt]&&0===t._a[gt]&&0===t._a[bt]&&0===t._a[wt]&&(t._nextDay=!0,t._a[vt]=0),t._d=(t._useUTC?Bt:function(t,e,n,i,r,o,s){var a=new Date(t,e,n,i,r,o,s);return t<100&&0<=t&&isFinite(a.getFullYear())&&a.setFullYear(t),a}).apply(null,a),o=t._useUTC?t._d.getUTCDay():t._d.getDay(),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[vt]=24),t._w&&void 0!==t._w.d&&t._w.d!==o&&(f(t).weekdayMismatch=!0)}}var de=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ye=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,me=/Z|[+-]\d\d(?::?\d\d)?/,_e=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],ve=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],ge=/^\/?Date\((\-?\d+)/i;function be(t){var e,n,i,r,o,s,a=t._i,u=de.exec(a)||ye.exec(a);if(u){for(f(t).iso=!0,e=0,n=_e.length;en.valueOf():n.valueOf()this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},ln.isLocal=function(){return!!this.isValid()&&!this._isUTC},ln.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},ln.isUtc=Be,ln.isUTC=Be,ln.zoneAbbr=function(){return this._isUTC?"UTC":""},ln.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},ln.dates=x("dates accessor is deprecated. Use date instead.",nn),ln.months=x("months accessor is deprecated. Use month instead",Dt),ln.years=x("years accessor is deprecated. Use year instead",Pt),ln.zone=x("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(t,e){return null!=t?("string"!=typeof t&&(t=-t),this.utcOffset(t,e),this):-this.utcOffset()}),ln.isDSTShifted=x("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!s(this._isDSTShifted))return this._isDSTShifted;var t={};if(_(t,this),(t=xe(t))._a){var e=t._isUTC?p(t._a):Pe(t._a);this._isDSTShifted=this.isValid()&&0 1 && arguments[1] !== undefined ? arguments[1] : []; + return with_type(type, actions.concat(['index_loading', 'index', 'index_error', 'show_loading', 'show', 'show_error', 'create_loading', 'create', 'create_error', 'update_loading', 'update', 'update_error', 'destroy_loading', 'destroy', 'destroy_error', 'upload_loading', 'upload_progress', 'upload_waiting', 'upload_complete', 'upload_error', 'sort'])); +}; + +/***/ }), + +/***/ "./app/client/api/crud.upload.js": +/*!***************************************!*\ + !*** ./app/client/api/crud.upload.js ***! + \***************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.upload_action = undefined; +exports.crud_upload = crud_upload; + +var _crud = __webpack_require__(/*! ./crud.types */ "./app/client/api/crud.types.js"); + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function crud_upload(type, fd, data, dispatch) { + return new Promise(function (resolve, reject) { + var id = data.id; + + Object.keys(data).forEach(function (key) { + if (key !== 'id') { + fd.append(key, data[key]); + } + }); + + console.log('/api/' + type + '/' + id + '/upload/'); + + var xhr = new XMLHttpRequest(); + xhr.upload.addEventListener("progress", uploadProgress, false); + xhr.addEventListener("load", uploadComplete, false); + xhr.addEventListener("error", uploadFailed, false); + xhr.addEventListener("abort", uploadCancelled, false); + xhr.open("POST", '/api/' + type + '/' + id + '/upload/'); + xhr.send(fd); + + dispatch && dispatch({ type: (0, _crud.as_type)(type, 'upload_loading') }); + + var complete = false; + + function uploadProgress(e) { + if (e.lengthComputable) { + var percent = Math.round(e.loaded * 100 / e.total) || 0; + if (percent > 99) { + dispatch && dispatch(_defineProperty({ + type: (0, _crud.as_type)(type, 'upload_waiting'), + percent: percent + }, type, id)); + } else { + dispatch && dispatch(_defineProperty({ + type: (0, _crud.as_type)(type, 'upload_progress'), + percent: percent + }, type, id)); + } + } else { + dispatch && dispatch(_defineProperty({ + type: (0, _crud.as_type)(type, 'upload_error'), + error: 'unable to compute upload progress' + }, type, id)); + } + } + + function uploadComplete(e) { + var parsed = void 0; + try { + parsed = JSON.parse(e.target.responseText); + } catch (e) { + dispatch && dispatch(_defineProperty({ + type: (0, _crud.as_type)(type, 'upload_error'), + error: 'upload failed' + }, type, id)); + reject(e); + return; + } + dispatch && dispatch(_defineProperty({ + type: (0, _crud.as_type)(type, 'upload_complete'), + data: parsed + }, type, id)); + if (parsed.files && parsed.files.length) { + parsed.files.forEach(function (file) { + console.log(file); + dispatch && dispatch({ + type: (0, _crud.as_type)('file', 'create'), + data: file + }); + }); + } + resolve(parsed); + } + + function uploadFailed(evt) { + dispatch && dispatch(_defineProperty({ + type: (0, _crud.as_type)(type, 'upload_error'), + error: 'upload failed' + }, type, id)); + reject(evt); + } + + function uploadCancelled(evt) { + dispatch && dispatch(_defineProperty({ + type: (0, _crud.as_type)(type, 'upload_error'), + error: 'upload cancelled' + }, type, id)); + reject(evt); + } + }); +} + +var upload_action = exports.upload_action = function upload_action(type, id, fd) { + return function (dispatch) { + return crud_upload(type, id, fd, dispatch); + }; +}; + +/***/ }), + +/***/ "./app/client/api/index.js": +/*!*********************************!*\ + !*** ./app/client/api/index.js ***! + \*********************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.actions = exports.parser = exports.util = undefined; + +var _crud = __webpack_require__(/*! ./crud.actions */ "./app/client/api/crud.actions.js"); + +var _util = __webpack_require__(/*! ../util */ "./app/client/util/index.js"); + +var _util2 = _interopRequireDefault(_util); + +var _parser = __webpack_require__(/*! ./parser */ "./app/client/api/parser.js"); + +var parser = _interopRequireWildcard(_parser); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/* +for our crud events, create corresponding actions +the actions fire a 'loading' event, call the underlying api method, and then resolve. +so you can do ... + import { folderActions } from '../../api' + folderActions.index({ module: 'samplernn' }) + folderActions.show(12) + folderActions.create({ module: 'samplernn', name: 'foo' }) + folderActions.update(12, { module: 'pix2pix' }) + folderActions.destroy(12, { confirm: true }) + folderActions.upload(12, form_data) +*/ + +exports.util = _util2.default; +exports.parser = parser; +var actions = exports.actions = ['folder', 'file', 'dataset', 'task', 'user'].reduce(function (a, b) { + return (a[b] = (0, _crud.crud_actions)(b)) && a; +}, {}); + +/***/ }), + +/***/ "./app/client/api/parser.js": +/*!**********************************!*\ + !*** ./app/client/api/parser.js ***! + \**********************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.tumblr = exports.thumbnail = exports.loadImage = exports.tag = exports.parse = exports.lookup = exports.integrations = undefined; + +var _nodeFetch = __webpack_require__(/*! node-fetch */ "./node_modules/node-fetch/browser.js"); + +var _nodeFetch2 = _interopRequireDefault(_nodeFetch); + +var _fetchJsonp = __webpack_require__(/*! fetch-jsonp */ "./node_modules/fetch-jsonp/build/fetch-jsonp.js"); + +var _fetchJsonp2 = _interopRequireDefault(_fetchJsonp); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var integrations = exports.integrations = [{ + type: 'image', + regex: /\.(jpeg|jpg|gif|png|svg)(\?.*)?$/i, + fetch: function fetch(url, done) { + var img = new Image(); + img.onload = function () { + if (!img) return; + var width = img.naturalWidth, + height = img.naturalHeight; + img = null; + done({ + url: url, + type: "image", + token: "", + thumbnail: "", + title: "", + width: width, + height: height + }); + }; + img.src = url; + if (img.complete) { + img.onload(); + } + }, + tag: function tag(media) { + return ''; + } +}, { + type: 'video', + regex: /\.(mp4|webm)(\?.*)?$/i, + fetch: function fetch(url, done) { + var video = document.createElement("video"); + var url_parts = url.replace(/\?.*$/, "").split("/"); + var filename = url_parts[url_parts.length - 1]; + video.addEventListener("loadedmetadata", function () { + var width = video.videoWidth, + height = video.videoHeight; + video = null; + done({ + url: url, + type: "video", + token: url, + thumbnail: "/public/assets/img/video-thumbnail.png", + title: filename, + width: width, + height: height + }); + }); + video.src = url; + video.load(); + }, + tag: function tag(media) { + return '