Skip to content

Commit

Permalink
feat: support for compreface mask plugin (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakowenko committed Sep 3, 2021
1 parent 83cea24 commit 7951524
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions api/src/util/detectors/compreface.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ module.exports.normalize = ({ data }) => {
...obj.gender,
probability: parseFloat((obj.gender.probability * 100).toFixed(2)),
};
if (obj.mask)
output.mask = {
...obj.mask,
probability: parseFloat((obj.mask.probability * 100).toFixed(2)),
};
return output;
});
return normalized;
Expand Down
11 changes: 10 additions & 1 deletion frontend/src/components/Asset.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,14 @@
<Badge v-if="asset.type && asset.type !== 'manual'" :value="asset.type" />
<Badge v-if="asset.zones.length" :value="[...asset.zones].join(', ')" />
<div v-for="gender in genders" :key="gender" class="badge-holder p-d-inline-block">
<Badge :value="gender.value + ' ' + gender.probability + '%'" />
<Badge :value="gender.value + ': ' + gender.probability + '%'" />
</div>
<div v-for="age in ages" :key="age" class="badge-holder p-d-inline-block">
<Badge :value="age.low + '-' + age.high + ': ' + age.probability + '%'" />
</div>
<div v-for="mask in masks" :key="mask" class="badge-holder p-d-inline-block">
<Badge :value="mask.value.replace(/_/g, ' ') + ': ' + mask.probability + '%'" />
</div>
</div>
</div>
<small v-if="type === 'match'">{{ createdAt.ago }}{{ updatedAt ? ` (updated ${updatedAt.ago})` : '' }}</small>
Expand Down Expand Up @@ -215,6 +218,12 @@ export default {
}
return data;
},
masks() {
const masks = [];
this.results.forEach((obj) => {
if (obj.mask) masks.push({ ...obj.mask });
});
return masks;
},
genders() {
const genders = [];
Expand Down

0 comments on commit 7951524

Please sign in to comment.