diff options
Diffstat (limited to 'app/client/modules/pix2pixhd/views')
| -rw-r--r-- | app/client/modules/pix2pixhd/views/pix2pixhd.train.js | 13 | ||||
| -rw-r--r-- | app/client/modules/pix2pixhd/views/sequence.editor.js | 27 |
2 files changed, 23 insertions, 17 deletions
diff --git a/app/client/modules/pix2pixhd/views/pix2pixhd.train.js b/app/client/modules/pix2pixhd/views/pix2pixhd.train.js index 1641976..c5e8e67 100644 --- a/app/client/modules/pix2pixhd/views/pix2pixhd.train.js +++ b/app/client/modules/pix2pixhd/views/pix2pixhd.train.js @@ -83,7 +83,7 @@ class Pix2PixHDTrain extends Component { if (folder.name === 'results') return const datasets = folder.datasets.map(name => { const dataset = datasetLookup[name] - if (dataset.checkpoints.length) { + if (dataset.isBuilt && dataset.checkpoints.length) { return name } return null @@ -104,10 +104,10 @@ class Pix2PixHDTrain extends Component { </div> <div className='columns'> <div className='column'> - <Group title='Dataset'> + <Group title='Sequence'> <SelectGroup name='checkpoint_name' - title='Dataset' + title='Sequence name' options={checkpointGroups} onChange={this.handleChange} placeholder='Pick a dataset' @@ -116,7 +116,7 @@ class Pix2PixHDTrain extends Component { <Select title="Epoch" name="epoch" - options={this.props.pix2pixhd.data.epochs} + options={this.props.pix2pixhd.epochs} onChange={this.handleChange} value={this.state.epoch} /> @@ -132,11 +132,12 @@ class Pix2PixHDTrain extends Component { renderEditor(){ const { pix2pixhd, queue } = this.props - const { checkpoint } = pix2pixhd + const { checkpoint, folder_id } = pix2pixhd return ( <div> <Group title='Sequence Editor'> <SequenceEditor + folder_id={folder_id} module={pix2pixhdModule} checkpoint={checkpoint} /> @@ -156,7 +157,7 @@ class Pix2PixHDTrain extends Component { }) }} onTrain={() => { - this.props.remote.train_task(this.state.checkpoint_name, pix2pixhd.folder_id, 1) + this.props.remote.train_task(this.state.checkpoint_name, folder_id, 1) setTimeout(() => { // auto-generate epoch demo this.props.remote.augment_task(this.state.checkpoint_name, { ...this.state, diff --git a/app/client/modules/pix2pixhd/views/sequence.editor.js b/app/client/modules/pix2pixhd/views/sequence.editor.js index 06f3889..33ed629 100644 --- a/app/client/modules/pix2pixhd/views/sequence.editor.js +++ b/app/client/modules/pix2pixhd/views/sequence.editor.js @@ -2,11 +2,13 @@ import { h, Component } from 'preact' import { bindActionCreators } from 'redux' import { connect } from 'react-redux' import { Route, Link } from 'react-router-dom' +import moment from 'moment/min/moment.min' import util from '../../../util' import { FileViewer, Timeline, Param, Button, Group, TextInput } from '../../../common' +import * as pix2pixhdTasks from '../pix2pixhd.tasks' import actions from '../../../actions' const initialState = { @@ -65,7 +67,7 @@ class SequenceEditor extends Component { console.log(checkpoint) this.setState({ ...initialState, - title: checkpoint.name + '_v_' + Date.now() + title: checkpoint.name + '_' + moment().format("YYYYMMDD") }) } @@ -78,28 +80,31 @@ class SequenceEditor extends Component { } render() { - const { app, checkpoint } = this.props + const { app, remote, checkpoint, folder_id } = this.props const { cursor, selection, title } = this.state const path = "sequences/" + checkpoint.name return ( <div className='sequenceEditor row'> {selection ? <div className='form'> + <Param title='Selection length'> + {selection.end.i - selection.start.i}{' frames'} + </Param> + <Param title='Duration'> + {util.frameTimestamp(selection.end.i - selection.start.i)} + </Param> <Group title='New dataset'> - <Param title='Selection length'> - {selection.end.i - selection.start.i}{' frames'} - </Param> - <Param title='Duration'> - {util.frameTimestamp(selection.end.i - selection.start.i)} - </Param> <TextInput title='Title dataset' value={title} - onInput={title => this.setState({ title })} + onInput={title => this.setState({ title: title.replace(/ /g, '_').replace(/\/\./g, '') })} /> <Button title='Create a new dataset?' - >Create</Button> + onClick={() => remote.create_dataset_task({ title, sequence: checkpoint.name, selection, folder_id })} + > + Create + </Button> </Group> </div> : <div className='form'><Group title='New dataset'>Please select some frames</Group></div> @@ -143,7 +148,7 @@ const mapStateToProps = state => ({ }) const mapDispatchToProps = (dispatch, ownProps) => ({ - actions: bindActionCreators({}, dispatch), + remote: bindActionCreators(pix2pixhdTasks, dispatch), }) export default connect(mapStateToProps, mapDispatchToProps)(SequenceEditor) |
