blob: 8b860076d93230a1ecb3f74ec4526c1af241b676 (
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
import { h, Component } from 'preact'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'
import * as samplernnActions from './samplernn.actions'
import Dataset from '../../dataset/dataset.component'
import Group from '../../common/group.component'
import Slider from '../../common/slider.component'
import Select from '../../common/select.component'
import Button from '../../common/button.component'
import { FileList, FileRow } from '../../common/fileList.component'
import TextInput from '../../common/textInput.component'
class SampleRNNDatasets extends Component {
constructor(props){
super()
this.fileOptions = this.fileOptions.bind(this)
this.pickFile = this.pickFile.bind(this)
let id = props.match.params.id
if (! id && props.location.pathname.match(/\/new\//)) {
id = 'new'
}
props.actions.load_directories(id)
}
pickFile(file){
console.log('pick', file)
}
fileOptions(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
const folder = samplernn.folder
if (!folder.name) return
console.log(folder)
const datasets = folder.datasets.map(dataset =>{
console.log(dataset)
return (
<div className='row dataset'>
<div className='col'>
{!!dataset.input.length && <FileList files={dataset.input} />}
</div>
<div className='col quiet'>
<div>{dataset.isBuilt ? 'has dataset' : 'not built'}</div>
</div>
<div className='col checkpoint'>
{!!dataset.checkpoints.length && <FileRow file={dataset.checkpoints[0]} />}
</div>
<div className='col'>
{!!dataset.output.length && <FileList files={dataset.output} />}
</div>
</div>
)
})
return (
<div className='app'>
<div className='heading'>
<h3>SampleRNN</h3>
</div>
<div class='rows params datasets'>
<div class='row dataset'>
<div class='col'>input</div>
<div class='col'>dataset</div>
<div class='col'>checkpoint</div>
<div class='col'>output</div>
</div>
{datasets}
</div>
</div>
)
}
}
// <Dataset
// canRename
// canUpload
// canAddURL
// canDeleteFile
// linkFiles
// fileOptions={this.fileOptions}
// onPick={this.handlePick}
// folder={samplernn.folder}
// files={samplernn.folder.files}
// />
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)(SampleRNNDatasets)
|