diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2019-01-13 23:23:17 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2019-01-13 23:23:17 +0100 |
| commit | 13655c42f9dd844a68f8c60a614641cdfa4c4277 (patch) | |
| tree | 8b729b04ac454e1e125c66ba38626c6c1c84bd0d /client | |
| parent | e3cfc630f52bce03c3e0e213ca93be6f748a77cb (diff) | |
displayiing all statistics
Diffstat (limited to 'client')
| -rw-r--r-- | client/faceAnalysis/faceAnalysis.actions.js | 2 | ||||
| -rw-r--r-- | client/faceAnalysis/faceAnalysis.result.js | 29 |
2 files changed, 27 insertions, 4 deletions
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 ( + <tr key={tag}> + <td> + {statisticsLabels[i]} + </td> + <td> + {data.data.statistics[tag]} + </td> + </tr> + ) + } + return null + }).filter(a => a) + return ( <div> - {!(step && total && message) ? '' : (<span>Step {step} / {total}: {message}</span>)} <div className='results'> {results} </div> + {!!statistics.length && ( + <table> + {statistics} + </table> + )} <div className="about"> - <small>Query took {(timing / 1000).toFixed(2)} s.</small> + <small>Step {step} / {total} {message}</small> + <small>Query {step === total ? 'took' : 'timer:'} {(timing / 1000).toFixed(2)} s.</small> </div> </div> ) |
