blob: f21d618b0c86ac6ad0dc41e14fe5feef402eebb0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
import { h, Component } from 'preact'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'
import * as samplernnActions from './samplernn.actions'
import { FileList } from '../../common/fileList.component'
import TextInput from '../../common/textInput.component'
class SampleRNNInspect extends Component {
constructor(props){
super()
this.fileOptions = this.fileOptions.bind(this)
this.pickFile = this.pickFile.bind(this)
props.actions.load_directories()
}
pickFile(file){
console.log('pick', file)
}
fileOptions(file){
// console.log(file)
if (file.activity === 'url' && !file.dataset) {
if (this.props.runner.cpu.status !== 'IDLE') {
return (
<div className='gray'>
fetching...
</div>
)
} else {
return (
<div className='link' onClick={() => this.fetchURL(file.url)}>
fetch
</div>
)
}
}
return (
<div>
<div className='link' onClick={() => this.train(file)}>train</div>
{file.epoch == 0 && <div className='epochs'>{file.epochs} ep.</div>}
</div>
)
}
fetchURL(url) {
}
render(){
const { samplernn } = this.props
// console.log(samplernn.upload)
// sort files??
return (
<div className='app'>
<div className='heading'>
<h3>SampleRNN (inspect)</h3>
</div>
{this.renderData()}
</div>
)
}
renderData(){
const { samplernn, actions } = this.props
console.log(samplernn)
if (! samplernn.data) return
return (
<div class='row params'>
<FileList
title='Folders'
className='folders'
fields={new Set(['name'])}
onPick={actions.set_folder}
files={samplernn.data.folders}
/>
<FileList
title='Files'
files={samplernn.data.files}
/>
<FileList
title='Datasets'
files={samplernn.data.builtDatasets}
/>
<FileList
title='Checkpoints'
files={samplernn.data.checkpoints}
/>
</div>
)
}
}
const mapStateToProps = state => ({
samplernn: state.module.samplernn,
runner: state.system.runner,
task: state.task,
})
const mapDispatchToProps = (dispatch, ownProps) => ({
actions: bindActionCreators(samplernnActions, dispatch),
})
export default connect(mapStateToProps, mapDispatchToProps)(SampleRNNInspect)
|