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.js46
1 files changed, 40 insertions, 6 deletions
diff --git a/app/client/modules/pix2pix/views/pix2pix.live.js b/app/client/modules/pix2pix/views/pix2pix.live.js
index eebb364..76b6727 100644
--- a/app/client/modules/pix2pix/views/pix2pix.live.js
+++ b/app/client/modules/pix2pix/views/pix2pix.live.js
@@ -44,6 +44,12 @@ class Pix2PixLive extends Component {
const frame = Math.floor(percentage * (parseInt(this.props.frame.sequence_len) || 1) + 1)
this.props.actions.seek(frame)
}
+ start(){
+ //
+ }
+ kill(){
+ //
+ }
togglePlaying(){
if (this.props.opt.processing) {
this.props.actions.pause()
@@ -99,12 +105,7 @@ class Pix2PixLive extends Component {
value={(this.props.frame.sequence_i || 0) / (this.props.frame.sequence_len || 1)}
onChange={this.seek}
/>
- <Button
- title={'Processing: ' + (this.props.opt.processing ? 'yes' : 'no')}
- onClick={this.togglePlaying}
- >
- {this.props.opt.processing ? 'Pause' : 'Restart'}
- </Button>
+ {this.renderRestartButton()}
<Button
title={
this.props.opt.savingVideo
@@ -234,6 +235,38 @@ class Pix2PixLive extends Component {
</div>
)
}
+ renderRestartButton(){
+ if (this.props.runner.gpu.status === 'IDLE') {
+ return (
+ <Button
+ title={'GPU Idle'}
+ onClick={this.start}
+ >Start</Button>
+ )
+ }
+ if (this.props.runner.gpu.task.module !== 'pix2pix') {
+ return (
+ <Button
+ title={'GPU Busy'}
+ onClick={this.kill}
+ >Kill</Button>
+ )
+ }
+ if (! this.props.opt.processing) {
+ return (
+ <Button
+ title={'Not processing'}
+ onClick={this.togglePlaying}
+ >Restart</Button>
+ )
+ }
+ return (
+ <Button
+ title={'Processing'}
+ onClick={this.togglePlaying}
+ >Restart</Button>
+ )
+ }
}
function timeInSeconds(n){
return (n / 10).toFixed(1) + ' s.'
@@ -244,6 +277,7 @@ const mapStateToProps = state => ({
checkpoints: state.live.checkpoints,
epochs: state.live.epochs,
sequences: state.live.sequences,
+ runner: state.system.runner,
})
const mapDispatchToProps = (dispatch, ownProps) => ({