summaryrefslogtreecommitdiff
path: root/app/client/modules
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-08-30 22:59:28 +0200
committerJules Laplace <julescarbon@gmail.com>2018-08-30 22:59:28 +0200
commit70b4cc5adcef18d498b539579ecfa626aa5e6c18 (patch)
treee86c4903e9916fef2775d1131d73c9d0b65f73a5 /app/client/modules
parentca53592e108e2189ef1b625c45d2b2a23b7ab145 (diff)
group sequences/checkpoints by folder
Diffstat (limited to 'app/client/modules')
-rw-r--r--app/client/modules/pix2pixhd/views/pix2pixhd.live.js49
1 files changed, 44 insertions, 5 deletions
diff --git a/app/client/modules/pix2pixhd/views/pix2pixhd.live.js b/app/client/modules/pix2pixhd/views/pix2pixhd.live.js
index b127e23..41ff7e5 100644
--- a/app/client/modules/pix2pixhd/views/pix2pixhd.live.js
+++ b/app/client/modules/pix2pixhd/views/pix2pixhd.live.js
@@ -4,7 +4,7 @@ import { connect } from 'react-redux'
import {
ParamGroup, Param, Player, Group,
- Slider, Select, TextInput, Button, Loading
+ Slider, SelectGroup, Select, TextInput, Button, Loading
} from '../../../common/'
import { startRecording, stopRecording, saveFrame, toggleFPS } from '../../../live/player'
@@ -39,6 +39,7 @@ class Pix2PixHDLive extends Component {
}
componentWillUpdate(nextProps) {
if (nextProps.opt.checkpoint_name && nextProps.opt.checkpoint_name !== this.props.opt.checkpoint_name) {
+ console.log('listing epochs')
this.props.actions.live.list_epochs('pix2pixhd', nextProps.opt.checkpoint_name)
}
}
@@ -101,6 +102,44 @@ class Pix2PixHDLive extends Component {
if (this.props.pix2pixhd.loading) {
return <Loading />
}
+ const { folderLookup, datasetLookup, sequences } = this.props.pix2pixhd.data
+
+ const sequenceLookup = sequences.reduce((a,b) => {
+ a[b.name] = true
+ return a
+ }, {})
+
+ const sequenceGroups = Object.keys(folderLookup).map(id => {
+ const folder = this.props.pix2pixhd.data.folderLookup[id]
+ if (folder.name === 'results') return
+ const datasets = folder.datasets.map(name => {
+ const sequence = sequenceLookup[name]
+ if (sequence) {
+ return name
+ }
+ return null
+ }).filter(n => !!n)
+ return {
+ name: folder.name,
+ options: datasets.sort(),
+ }
+ }).filter(n => !!n && !!n.options.length).sort((a,b) => a.name.localeCompare(b.name))
+
+ const checkpointGroups = Object.keys(folderLookup).map(id => {
+ const folder = this.props.pix2pixhd.data.folderLookup[id]
+ if (folder.name === 'results') return
+ const datasets = folder.datasets.map(name => {
+ const dataset = datasetLookup[name]
+ if (dataset.checkpoints.length) {
+ return name
+ }
+ return null
+ }).filter(n => !!n)
+ return {
+ name: folder.name,
+ options: datasets.sort(),
+ }
+ }).filter(n => !!n && !!n.options.length).sort((a,b) => a.name.localeCompare(b.name))
return (
<div className='app live centered'>
<Player width={424} height={256} fullscreen={this.props.fullscreen} />
@@ -116,16 +155,16 @@ class Pix2PixHDLive extends Component {
options={['a','b','sequence','recursive']}
onChange={this.props.actions.live.set_param}
/>
- <Select live
+ <SelectGroup live
name='sequence_name'
title='sequence'
- options={this.props.pix2pixhd.data.sequences.map(file => file.name)}
+ options={sequenceGroups}
onChange={this.changeSequence}
/>
- <Select live
+ <SelectGroup live
name='checkpoint_name'
title='checkpoint'
- options={this.props.pix2pixhd.data.checkpoints.map(file => file.name)}
+ options={checkpointGroups}
onChange={this.changeCheckpoint}
/>
<Select live