Skip to content

Commit

Permalink
fix promise turn
Browse files Browse the repository at this point in the history
  • Loading branch information
yorkie committed May 22, 2020
1 parent 92eac4f commit 7577026
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/daemon/assets/predict.js
Expand Up @@ -24,11 +24,16 @@ const model = modelDefineModule(null, {

function predict(data) {
const sample = { data, label: null };
let future = model;

if (typeof dataProcessModule === 'function') {
dataProcessModule(sample, {}, pipeline.dataProcessParams);
future = future.then((m) => {
dataProcessModule(sample, {}, pipeline.dataProcessParams);
return m
});
}
return model.then((m) => {
return m.predict(sample);
return future.then((m) => {
m.predict(sample);
});
};

Expand Down

0 comments on commit 7577026

Please sign in to comment.