mirror of
https://github.com/wassname/keras-js.git
synced 2026-09-10 12:15:12 +08:00
modify model initialize function
This commit is contained in:
+3
-12
@@ -31,8 +31,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/transcranial/keras-js#readme",
|
||||
"dependencies": {
|
||||
"axios": "^0.14.0",
|
||||
"bluebird": "^3.4.6",
|
||||
"babel-polyfill": "^6.13.0",
|
||||
"cwise": "^1.0.9",
|
||||
"lodash": "^4.15.0",
|
||||
"ndarray": "^1.0.18",
|
||||
@@ -49,12 +48,11 @@
|
||||
"babel-core": "^6.14.0",
|
||||
"babel-eslint": "^6.1.2",
|
||||
"babel-loader": "^6.2.5",
|
||||
"babel-plugin-transform-async-to-module-method": "^6.8.0",
|
||||
"babel-plugin-transform-class-properties": "^6.11.5",
|
||||
"babel-plugin-transform-object-rest-spread": "^6.8.0",
|
||||
"babel-preset-latest": "^6.14.0",
|
||||
"http-server": "^0.9.0",
|
||||
"standard": "^8.0.0",
|
||||
"standard": "^8.1.0",
|
||||
"webpack": "^2.1.0-beta.22"
|
||||
},
|
||||
"standard": {
|
||||
@@ -75,14 +73,7 @@
|
||||
],
|
||||
"plugins": [
|
||||
"transform-class-properties",
|
||||
"transform-object-rest-spread",
|
||||
[
|
||||
"transform-async-to-module-method",
|
||||
{
|
||||
"module": "bluebird",
|
||||
"method": "coroutine"
|
||||
}
|
||||
]
|
||||
"transform-object-rest-spread"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
+9
-12
@@ -1,5 +1,4 @@
|
||||
/* global XMLHttpRequest */
|
||||
import Promise from 'bluebird'
|
||||
import toPairs from 'lodash/toPairs'
|
||||
import mapKeys from 'lodash/mapKeys'
|
||||
import camelCase from 'lodash/camelCase'
|
||||
@@ -88,21 +87,19 @@ export default class Model {
|
||||
* Model initialization
|
||||
* @returns {Promise}
|
||||
*/
|
||||
async initialize () {
|
||||
initialize () {
|
||||
const dataTypes = ['model', 'weights', 'metdata']
|
||||
try {
|
||||
// get data
|
||||
await Promise.all(dataTypes.map(type => {
|
||||
return this.dataRequest(type, this.config.headers)
|
||||
}))
|
||||
// create layers
|
||||
return Promise.all(
|
||||
dataTypes.map(type => this.dataRequest(type, this.config.headers))
|
||||
)
|
||||
.then(() => {
|
||||
this.createLayers()
|
||||
return Promise.resolve()
|
||||
} catch (err) {
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err)
|
||||
this.interrupt()
|
||||
return Promise.reject(err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -202,6 +199,6 @@ export default class Model {
|
||||
* Predict API
|
||||
*/
|
||||
predict (data) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user