diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-09-21 22:49:55 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-09-21 22:49:55 +0200 |
| commit | 15d5cea9d1d94a6893ef1a55a916e68a182e5394 (patch) | |
| tree | b0d71498d2a0649c7180940a38d2fbfa595ca515 /app/client/modules/pix2pixhd | |
| parent | 270d9ccc3f93f29559dbf9c746070812a63e99e1 (diff) | |
browser is just a component
Diffstat (limited to 'app/client/modules/pix2pixhd')
| -rw-r--r-- | app/client/modules/pix2pixhd/views/pix2pixhd.train.js | 54 | ||||
| -rw-r--r-- | app/client/modules/pix2pixhd/views/sequence.editor.js | 89 |
2 files changed, 116 insertions, 27 deletions
diff --git a/app/client/modules/pix2pixhd/views/pix2pixhd.train.js b/app/client/modules/pix2pixhd/views/pix2pixhd.train.js index 06caa5a..957b068 100644 --- a/app/client/modules/pix2pixhd/views/pix2pixhd.train.js +++ b/app/client/modules/pix2pixhd/views/pix2pixhd.train.js @@ -114,6 +114,33 @@ class Pix2PixHDTrain extends Component { value={this.state.epoch} /> </Group> + <Group title='Augmentation Grid'> + <AugmentationGrid + checkpoint={this.props.pix2pixhd.checkpoint} + take={[1,2,3,4,5,10,15,20,25,50,75,100,200,300,400,500,1000]} + make={[1,2,3,4,5,10,15,20,25,50,75,100,200,]} + onAugment={(augment_take, augment_make) => { + this.props.remote.augment_task(this.state.checkpoint_name, { + ...this.state, + augment_take, + augment_make, + }) + }} + onTrain={() => { + this.props.remote.train_task(this.state.checkpoint_name, pix2pixhd.folder_id, 1) + setTimeout(() => { // auto-generate epoch demo + this.props.remote.augment_task(this.state.checkpoint_name, { + ...this.state, + augment_take: 10, + augment_make: 150, + no_symlinks: true, + mov: true, + folder_id: this.props.pix2pixhd.data.resultsFolder.id + }) + }, 250) + }} + /> + </Group> <Group title='Augment'> <NumberInput name="augment_take" @@ -151,33 +178,6 @@ class Pix2PixHDTrain extends Component { }} /> </Group> - <Group title='Augmentation Grid'> - <AugmentationGrid - checkpoint={this.props.pix2pixhd.checkpoint} - take={[1,2,3,4,5,10,15,20,25,50,75,100,200,300,400,500,1000]} - make={[1,2,3,4,5,10,15,20,25,50,75,100,200,]} - onAugment={(augment_take, augment_make) => { - this.props.remote.augment_task(this.state.checkpoint_name, { - ...this.state, - augment_take, - augment_make, - }) - }} - onTrain={() => { - this.props.remote.train_task(this.state.checkpoint_name, pix2pixhd.folder_id, 1) - setTimeout(() => { // auto-generate epoch demo - this.props.remote.augment_task(this.state.checkpoint_name, { - ...this.state, - augment_take: 10, - augment_make: 150, - no_symlinks: true, - mov: true, - folder_id: this.props.pix2pixhd.data.resultsFolder.id - }) - }, 250) - }} - /> - </Group> <Group title='Status'> <Button diff --git a/app/client/modules/pix2pixhd/views/sequence.editor.js b/app/client/modules/pix2pixhd/views/sequence.editor.js new file mode 100644 index 0000000..9693805 --- /dev/null +++ b/app/client/modules/pix2pixhd/views/sequence.editor.js @@ -0,0 +1,89 @@ +import { h, Component } from 'preact' +import { bindActionCreators } from 'redux' +import { connect } from 'react-redux' +import { Route, Link } from 'react-router-dom' + +import { Loading, FileList, FileViewer } from '../../common' + +import actions from '../actions' + +class SequenceEditor extends Component { + state = { + dir: '/', + files: [], + loading: true + } + componentDidMount() { + this.fetch(this.state.dir) + } + handlePick(file) { + console.log(file) + if (file.dir) { + this.fetch([this.state.dir, file.name].join('/').replace('//','/')) + } else { + this.fetchFile([this.state.dir, file.name].join('/').replace('//','/')) + } + } + fetch(dir) { + console.log('fetch', dir) + const { tool: module } = this.props.app + this.setState({ dir, file: null, loading: true }) + actions.socket.list_directory({ module, dir }).then(files => { + console.log(files) + this.setState({ dir, files, loading: false }) + }) + } + fetchFile(fn) { + console.log('fetch file', fn) + const { tool: module } = this.props.app + this.setState({ file: null, loadingFile: true }) + actions.socket.read_file({ module, fn }).then(file => { + console.log(file) + this.setState({ file, loadingFile: false }) + }) + } + render() { + const { app } = this.props + const { + loading, dir, files, + loadingFile, file, + } = this.state + console.log(this.props, this.state) + // return ( + // <div className='app browser'> + // <h1>{dir}{dir[dir.length-1] !== '/' && '/'}</h1> + // {app.tool}<br/> + // {loading && <Loading />} + // <FileList + // files={files} + // groupDirectories + // parentDirectory={dir !== '/'} + // orderBy='name asc' + // fields={'name datetime size'} + // onClick={(file, e) => { + // e.preventDefault() + // e.stopPropagation() + // console.log('picked a result', file) + // this.handlePick(file) + // }} + // onClickParent={e => { + // console.log('navigate up') + // this.fetch(this.state.dir.split('/').slice(0, -1).join('/') || '/') + // }} + // /> + // {loadingFile && <Loading />} + // {file && <FileViewer file={file} />} + // </div> + // ) + } +} + +const mapStateToProps = state => ({ + app: state.system.app, +}) + +const mapDispatchToProps = (dispatch, ownProps) => ({ + actions: bindActionCreators({}, dispatch), +}) + +export default connect(mapStateToProps, mapDispatchToProps)(SequenceEditor) |
