summaryrefslogtreecommitdiff
path: root/app/client/modules/pix2pix/views/pix2pix.live.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/client/modules/pix2pix/views/pix2pix.live.js')
-rw-r--r--app/client/modules/pix2pix/views/pix2pix.live.js79
1 files changed, 47 insertions, 32 deletions
diff --git a/app/client/modules/pix2pix/views/pix2pix.live.js b/app/client/modules/pix2pix/views/pix2pix.live.js
index 52fe055..ae68307 100644
--- a/app/client/modules/pix2pix/views/pix2pix.live.js
+++ b/app/client/modules/pix2pix/views/pix2pix.live.js
@@ -10,18 +10,19 @@ import {
import { startRecording, stopRecording, saveFrame } from '../../../live/player'
import * as liveActions from '../../../live/live.actions'
+import * as queueActions from '../../../queue/queue.actions'
import * as pix2pixTasks from '../pix2pix.tasks'
import * as pix2pixActions from '../pix2pix.actions'
class Pix2PixLive extends Component {
constructor(props){
super()
- if (! props.pix2pix || ! props.pix2pix.data) {
- props.pix2pixActions.load_directories()
- }
- props.actions.get_params()
- props.actions.list_checkpoints('pix2pix')
- props.actions.list_sequences('pix2pix')
+ // if (! props.pix2pix || ! props.pix2pix.data) {
+ props.actions.pix2pix.load_directories()
+ // }
+ props.actions.live.get_params()
+ props.actions.live.list_checkpoints('pix2pix')
+ props.actions.live.list_sequences('pix2pix')
this.changeCheckpoint = this.changeCheckpoint.bind(this)
this.changeEpoch = this.changeEpoch.bind(this)
this.changeSequence = this.changeSequence.bind(this)
@@ -31,45 +32,44 @@ class Pix2PixLive extends Component {
}
componentWillUpdate(nextProps) {
if (nextProps.opt.checkpoint_name && nextProps.opt.checkpoint_name !== this.props.opt.checkpoint_name) {
- this.props.actions.list_epochs('pix2pix', nextProps.opt.checkpoint_name)
+ this.props.actions.live.list_epochs('pix2pix', nextProps.opt.checkpoint_name)
}
}
- changeCheckpoint(checkpoint_name){
- this.props.actions.load_epoch(checkpoint_name, 'latest')
+ changeCheckpoint(field, checkpoint_name){
+ this.props.actions.live.load_epoch(checkpoint_name, 'latest')
}
- changeEpoch(epoch_name){
- this.props.actions.load_epoch(this.props.opt.checkpoint_name, epoch_name)
+ changeEpoch(field, epoch_name){
+ this.props.actions.live.load_epoch(this.props.opt.checkpoint_name, epoch_name)
}
- changeSequence(sequence){
+ changeSequence(field, sequence){
console.log('got sequence', sequence)
- this.props.actions.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)
- this.props.actions.seek(frame)
+ this.props.actions.live.seek(frame)
}
start(){
// console.log(this.props)
const sequence = this.props.pix2pix.data.sequences[0].name
const checkpoint = this.props.pix2pix.data.checkpoints[0].name
console.log('starting up!', sequence, checkpoint)
- this.props.pix2pixTasks.live_task(sequence, checkpoint)
+ this.props.actions.tasks.live_task(sequence, checkpoint)
}
interrupt(){
- //
+ this.props.actions.queue.stop_task('gpu')
}
togglePlaying(){
- console.log('are we..........', this.props.opt.processing)
if (this.props.opt.processing) {
- this.props.actions.pause()
+ this.props.actions.live.pause()
} else {
- this.props.actions.play()
+ this.props.actions.live.play()
}
}
toggleRecording(){
if (this.props.opt.recording){
stopRecording()
- this.props.actions.pause()
+ this.props.actions.live.pause()
} else {
startRecording()
}
@@ -92,7 +92,7 @@ class Pix2PixLive extends Component {
name='send_image'
title='view mode'
options={['a','b','sequence','recursive']}
- onChange={this.props.actions.set_param}
+ onChange={this.props.actions.live.set_param}
/>
<Select
name='sequence_name'
@@ -267,17 +267,29 @@ class Pix2PixLive extends Component {
}
if (! this.props.opt.processing) {
return (
- <Button
- title={'Not processing'}
- onClick={this.togglePlaying}
- >Restart</Button>
+ <div>
+ <Button
+ title={'Not processing'}
+ onClick={this.togglePlaying}
+ >Restart</Button>
+ <Button
+ title={'GPU Busy'}
+ onClick={() => this.interrupt()}
+ >Interrupt</Button>
+ </div>
)
}
return (
- <Button
- title={'Processing'}
- onClick={this.togglePlaying}
- >Pause</Button>
+ <div>
+ <Button
+ title={'Processing'}
+ onClick={this.togglePlaying}
+ >Pause</Button>
+ <Button
+ title={'GPU Busy'}
+ onClick={() => this.interrupt()}
+ >Interrupt</Button>
+ </div>
)
}
}
@@ -295,9 +307,12 @@ const mapStateToProps = state => ({
})
const mapDispatchToProps = (dispatch, ownProps) => ({
- actions: bindActionCreators(liveActions, dispatch),
- pix2pixActions: bindActionCreators(pix2pixActions, dispatch),
- pix2pixTasks: bindActionCreators(pix2pixTasks, dispatch),s
+ actions: {
+ live: bindActionCreators(liveActions, dispatch),
+ queue: bindActionCreators(queueActions, dispatch),
+ pix2pix: bindActionCreators(pix2pixActions, dispatch),
+ tasks: bindActionCreators(pix2pixTasks, dispatch),s
+ }
})
export default connect(mapStateToProps, mapDispatchToProps)(Pix2PixLive)