From fe8ab6133a31284d94944f5d75da9d6ad2b2bdb9 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 18 Dec 2019 21:13:05 +0100 Subject: adding biggan --- app/client/modules/biggan/views/biggan.live.js | 180 +++++++++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 app/client/modules/biggan/views/biggan.live.js (limited to 'app/client/modules/biggan/views/biggan.live.js') diff --git a/app/client/modules/biggan/views/biggan.live.js b/app/client/modules/biggan/views/biggan.live.js new file mode 100644 index 0000000..ba96ff2 --- /dev/null +++ b/app/client/modules/biggan/views/biggan.live.js @@ -0,0 +1,180 @@ +import { h, Component } from 'preact' +import { bindActionCreators } from 'redux' +import { connect } from 'react-redux' + +import { + ParamGroup, Param, Player, Group, + Slider, SelectGroup, Select, TextInput, Button, Loading +} from '../../../common/' + +import { startRecording, stopRecording, saveFrame, toggleFPS } from '../../../live/player' + +import * as liveActions from '../../../live/live.actions' +import * as queueActions from '../../../queue/queue.actions' +import * as bigganTasks from '../biggan.tasks' +import * as bigganActions from '../biggan.actions' + +class BigGANLive extends Component { + constructor(props) { + super() + } + start(){ + console.log(this.props.opt) + console.log('starting up!') + this.props.actions.tasks.live_task({ + folder_id: this.props.biggan.data.resultsFolder.id, + }) + } + interrupt(){ + this.props.actions.queue.stop_task('gpu') + } + render() { + const { biggan } = this.props + // if (biggan.loading) { + // return + // } + return ( +
+
+
+ +
+
+ + {this.renderRestartButton()} + + + + + + + + + + + + + + + + + + + + +
+
+
+ ) + } + renderRestartButton(){ + // console.log(this.props.runner.gpu) + const { i18n } = this.props + if (this.props.runner.gpu.status === 'IDLE') { + return ( + + ) + } + if (this.props.runner.gpu.task.module !== 'pix2pixhd') { + return ( + + ) + } + if (! this.props.opt.processing) { + return ( +
+ + +
+ ) + } + return ( +
+ + +
+ ) + } +} + + +const mapStateToProps = state => ({ + last_message: state.live.last_message, + fullscreen: state.live.fullscreen, + opt: state.live.opt, + frame: state.live.frame, + runner: state.system.runner, + i18n: state.system.i18n.strings, + biggan: state.module.biggan, +}) + +const mapDispatchToProps = (dispatch, ownProps) => ({ + actions: { + live: bindActionCreators(liveActions, dispatch), + queue: bindActionCreators(queueActions, dispatch), + biggan: bindActionCreators(bigganActions, dispatch), + tasks: bindActionCreators(bigganTasks, dispatch), + } +}) + +export default connect(mapStateToProps, mapDispatchToProps)(BigGANLive) -- cgit v1.2.3-70-g09d2