19 lines
469 B
JavaScript
19 lines
469 B
JavaScript
'use strict';
|
|
|
|
const safeContent = [ 'Drawing', 'Neutral' ];
|
|
|
|
const contentBoundary = predictions => {
|
|
let safeProbability = 0;
|
|
for (let index = 0; index < predictions.length; index++) {
|
|
const item = predictions[index];
|
|
const className = item.className;
|
|
const probability = item.probability;
|
|
if (safeContent.includes(className)) {
|
|
safeProbability += probability;
|
|
}
|
|
}
|
|
return safeProbability > 0.5;
|
|
};
|
|
|
|
module.exports = contentBoundary;
|