summaryrefslogtreecommitdiff
path: root/app/client
diff options
context:
space:
mode:
Diffstat (limited to 'app/client')
-rw-r--r--app/client/common/fileUpload.component.js2
-rw-r--r--app/client/dashboard/dashboard.component.js2
-rw-r--r--app/client/modules/biggan/biggan.actions.js37
-rw-r--r--app/client/modules/biggan/biggan.reducer.js6
-rw-r--r--app/client/modules/biggan/views/biggan.encodingList.js68
-rw-r--r--app/client/modules/biggan/views/biggan.live.js4
-rw-r--r--app/client/modules/pix2pixhd/pix2pixhd.actions.js4
-rw-r--r--app/client/types.js2
8 files changed, 119 insertions, 6 deletions
diff --git a/app/client/common/fileUpload.component.js b/app/client/common/fileUpload.component.js
index bc78184..e024f62 100644
--- a/app/client/common/fileUpload.component.js
+++ b/app/client/common/fileUpload.component.js
@@ -17,8 +17,8 @@ class FileUpload extends Component {
if (!f) continue
break
// if (!f.type.match(this.props.mime)) continue
+ this.props.onUpload && this.props.onUpload(f)
}
- this.props.onUpload && this.props.onUpload(f)
}
render() {
return (
diff --git a/app/client/dashboard/dashboard.component.js b/app/client/dashboard/dashboard.component.js
index 8f47049..b13a5e3 100644
--- a/app/client/dashboard/dashboard.component.js
+++ b/app/client/dashboard/dashboard.component.js
@@ -34,7 +34,7 @@ class Dashboard extends Component {
}
const { tasks } = queue
const folders = foldersByModule && Object.keys(modules).sort().map(key => {
- let path = key === 'samplernn' ? '/samplernn/datasets/' : '/' + key + '/sequences/'
+ let path = (key === 'samplernn' || key === 'biggan') ? '/samplernn/datasets/' : '/' + key + '/sequences/'
let folder_list = (foldersByModule[key] || []).map(folder => {
return (
<div key={folder.id}>
diff --git a/app/client/modules/biggan/biggan.actions.js b/app/client/modules/biggan/biggan.actions.js
index df78481..f09510c 100644
--- a/app/client/modules/biggan/biggan.actions.js
+++ b/app/client/modules/biggan/biggan.actions.js
@@ -155,7 +155,7 @@ export const load_directories = (id) => (dispatch) => {
export const load_results = (id) => (dispatch) => {
const module = bigganModule.name
util.allProgress([
- actions.folder.index({ name: 'results' }),
+ actions.folder.index({ module, name: 'results' }),
actions.file.index({ module, generated: 1, limit: 250 }),
// actions.socket.list_directory({ module, dir: 'renders' }),
// actions.socket.list_sequences({ module, dir: 'results' }),
@@ -178,3 +178,38 @@ export const load_results = (id) => (dispatch) => {
})
})
}
+
+export const load_encodings = () => dispatch => {
+ const module = bigganModule.name
+ util.allProgress([
+ actions.folder.index({ module }),
+ actions.file.index({
+ module,
+ datatype: 'image',
+ generated: 1,
+ }),
+ ], (folders, files) => {
+ console.log(folders, files)
+ const folder_name_lookup = {}
+ const encodings = {}
+ folders.forEach(folder => {
+ folder_name_lookup[folder.id] = folder.name
+ encodings[folder.name] = []
+ })
+ files.forEach(file => {
+ folder_name = folder_name_lookup[file.folder_id]
+ encodings[folder_name].push(file)
+ })
+ folders.forEach(folder => {
+ if (!encodings[folder.name].length) {
+ delete encodings[folder_name]
+ }
+ })
+ dispatch({
+ type: types.biggan.load_encodings,
+ encodings
+ })
+
+ })
+}
+
diff --git a/app/client/modules/biggan/biggan.reducer.js b/app/client/modules/biggan/biggan.reducer.js
index a0c9842..d5b331c 100644
--- a/app/client/modules/biggan/biggan.reducer.js
+++ b/app/client/modules/biggan/biggan.reducer.js
@@ -8,6 +8,7 @@ const bigganInitialState = {
folder_id: 0,
data: null,
results: null,
+ encodings: null,
checkpoint: {
name: '',
sequenceCount: 0,
@@ -26,6 +27,11 @@ const bigganReducer = (state = bigganInitialState, action) => {
...state,
results: action.results,
}
+ case types.biggan.load_encodings:
+ return {
+ ...state,
+ encodings: action.encodings,
+ }
case types.file.destroy:
console.log('file destroy', state.results)
return {
diff --git a/app/client/modules/biggan/views/biggan.encodingList.js b/app/client/modules/biggan/views/biggan.encodingList.js
new file mode 100644
index 0000000..d041e2e
--- /dev/null
+++ b/app/client/modules/biggan/views/biggan.encodingList.js
@@ -0,0 +1,68 @@
+import { h, Component } from 'preact'
+import { bindActionCreators } from 'redux'
+import { connect } from 'react-redux'
+
+import {
+ Loading
+} from '../../../common/'
+
+import actions from '../../../actions'
+import * as bigganTasks from '../biggan.tasks'
+import * as bigganActions from '../biggan.actions'
+
+const ALL_CATEGORIES = 'inversion/categories/biggan_all.json'
+
+class BigGANEncodingList extends Component {
+ constructor() {
+ super()
+ if (!this.props.encodings) {
+ this.actions.biggan.load_encodings()
+ }
+ }
+
+ render() {
+ const { encodings } = this.props
+ if (!encodings) {
+ return <div>Loading encodings...</div>
+ }
+ return (
+ <div>
+ <div>
+ <select>
+ </select>
+ </div>
+ <div className="categories" ref={ref => this.categoryRef = ref}>
+ {Object.keys(encodings).sort().map(name => {
+ return (
+ <div key={name}>
+ {encodings[name].map(file => (
+ <img
+ key={file.id}
+ src={file.url}
+ onClick={() => actions.live.send_command('setEncoding', 'id=' + file.id)}
+ />
+ ))}
+ </div>
+ )
+ })}
+ </div>
+ </div>
+ )
+ }
+
+}
+
+const mapStateToProps = state => ({
+ opt: state.live.opt,
+ frame: state.live.frame,
+ biggan: state.module.biggan,
+})
+
+const mapDispatchToProps = (dispatch, ownProps) => ({
+ actions: {
+ biggan: bindActionCreators(bigganActions, dispatch),
+ tasks: bindActionCreators(bigganTasks, dispatch),
+ }
+})
+
+export default connect(mapStateToProps, mapDispatchToProps)(BigGANCategoryList)
diff --git a/app/client/modules/biggan/views/biggan.live.js b/app/client/modules/biggan/views/biggan.live.js
index af1edea..8d4a234 100644
--- a/app/client/modules/biggan/views/biggan.live.js
+++ b/app/client/modules/biggan/views/biggan.live.js
@@ -14,6 +14,7 @@ import * as queueActions from '../../../queue/queue.actions'
import * as bigganTasks from '../biggan.tasks'
import * as bigganActions from '../biggan.actions'
import BigGANCategoryList from './biggan.categoryList.js'
+import BigGANEncodingList from './biggan.encodingList.js'
class BigGANLive extends Component {
constructor(props) {
@@ -120,6 +121,9 @@ class BigGANLive extends Component {
<div className='params column'>
<BigGANCategoryList />
</div>
+ <div className='params column'>
+ <BigGANEncodingList />
+ </div>
</div>
</div>
)
diff --git a/app/client/modules/pix2pixhd/pix2pixhd.actions.js b/app/client/modules/pix2pixhd/pix2pixhd.actions.js
index 5ee6759..9b18ee4 100644
--- a/app/client/modules/pix2pixhd/pix2pixhd.actions.js
+++ b/app/client/modules/pix2pixhd/pix2pixhd.actions.js
@@ -155,7 +155,7 @@ export const load_directories = (id) => (dispatch) => {
export const load_results = (id) => (dispatch) => {
const module = pix2pixhdModule.name
util.allProgress([
- actions.folder.index({ name: 'results' }),
+ actions.folder.index({ module, name: 'results' }),
actions.file.index({ module, generated: 1, limit: 250 }),
actions.socket.list_directory({ module, dir: 'renders' }),
actions.socket.list_sequences({ module, dir: 'results' }),
@@ -184,7 +184,7 @@ export const load_results = (id) => (dispatch) => {
export const load_uprez = (id) => (dispatch) => {
const module = pix2pixhdModule.name
util.allProgress([
- actions.folder.index({ name: 'results' }),
+ actions.folder.index({ module, name: 'results' }),
actions.socket.list_sequences({ module, dir: 'results' }),
actions.file.index({ module, activity: 'uprez' }),
], (percent, i, n) => {
diff --git a/app/client/types.js b/app/client/types.js
index 46b4307..2055920 100644
--- a/app/client/types.js
+++ b/app/client/types.js
@@ -118,7 +118,7 @@ export default {
// queue new checkpoint
},
biggan: with_type('biggan', [
- 'init', 'set_folder', 'load_results',
+ 'init', 'set_folder', 'load_results', 'load_encodings',
]),
pix2pix: with_type('pix2pix', [
'init', 'set_folder'