From 13655c42f9dd844a68f8c60a614641cdfa4c4277 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 13 Jan 2019 23:23:17 +0100 Subject: displayiing all statistics --- client/faceAnalysis/faceAnalysis.actions.js | 2 +- client/faceAnalysis/faceAnalysis.result.js | 29 ++++++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) (limited to 'client') diff --git a/client/faceAnalysis/faceAnalysis.actions.js b/client/faceAnalysis/faceAnalysis.actions.js index 2d372c1e..4a6fe6ed 100644 --- a/client/faceAnalysis/faceAnalysis.actions.js +++ b/client/faceAnalysis/faceAnalysis.actions.js @@ -81,7 +81,7 @@ export const upload = (payload, file) => dispatch => { post(url.upload(), fd) .then(data => { // console.log('loaded!', tag, data) - dispatch(polled(tag, data)) + dispatch(loaded(tag, data)) const { result, taskURL } = data if (result && taskURL) { poll(payload, taskURL)(dispatch) diff --git a/client/faceAnalysis/faceAnalysis.result.js b/client/faceAnalysis/faceAnalysis.result.js index 1c8a2ffb..e7a4c6de 100644 --- a/client/faceAnalysis/faceAnalysis.result.js +++ b/client/faceAnalysis/faceAnalysis.result.js @@ -66,7 +66,6 @@ class FaceAnalysisResult extends Component { console.log(data.data) const results = [ 'blur_fn', 'points_3d_68', 'landmarks_3d_68', 'landmarks_2d_68', 'pose', - 'age_real', 'age_apparent', 'gender' ].map(tag => { if (tag in data.data) { const { title, url } = data.data[tag] @@ -80,14 +79,38 @@ class FaceAnalysisResult extends Component { return null }).filter(a => a) + const statisticsLabels = ['Age (Real)', 'Age (Apparent)', 'Gender', 'Beauty score', 'Emotion'] + const statistics = [ + 'age_real', 'age_apparent', 'gender', 'beauty', 'emotion' + ].map((tag, i) => { + if (tag in data.data.statistics) { + return ( + + + {statisticsLabels[i]} + + + {data.data.statistics[tag]} + + + ) + } + return null + }).filter(a => a) + return (
- {!(step && total && message) ? '' : (Step {step} / {total}: {message})}
{results}
+ {!!statistics.length && ( + + {statistics} +
+ )}
- Query took {(timing / 1000).toFixed(2)} s. + Step {step} / {total} {message} + Query {step === total ? 'took' : 'timer:'} {(timing / 1000).toFixed(2)} s.
) -- cgit v1.2.3-70-g09d2