Skip to content

Commit

Permalink
fix all blurred when both genders are selected
Browse files Browse the repository at this point in the history
  • Loading branch information
alganzory committed Mar 22, 2024
1 parent 3a1b7dc commit dacf8fa
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/modules/detector.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,16 +324,19 @@ const containsNsfw = (nsfwDetections, strictness) => {
};

const genderPredicate = (gender, score, detectMale, detectFemale) => {
if (detectMale && detectFemale) return gender !== "unknown";

const mPredicate = (gender === "male" && score > 0.3) ||
(gender === "female" && score < 0.2)

const fePredicate = (gender === "female" && score > 0.25)

if (detectMale && detectFemale) return mPredicate || fePredicate;

if (detectMale && !detectFemale) {
return (
(gender === "male" && score > 0.3) ||
(gender === "female" && score < 0.2)
);
return mPredicate
}
if (!detectMale && detectFemale) {
return gender === "female" && score > 0.25;
return fePredicate
}

return false;
Expand All @@ -345,7 +348,6 @@ const containsGenderFace = (detections, detectMale, detectFemale) => {
}

const faces = detections.face;
if (detectMale && detectFemale) return faces.some((face) => face.age > 20);
if (detectMale || detectFemale)
return faces.some(
(face) =>
Expand Down

0 comments on commit dacf8fa

Please sign in to comment.