mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 19:14:16 +00:00
22 lines
516 B
JavaScript
Executable File
22 lines
516 B
JavaScript
Executable File
const minumunPredictions = {
|
|
"Hentai": 0.8,
|
|
"Porn": 0.7,
|
|
}
|
|
|
|
export default (predictions) => {
|
|
if (!Array.isArray(predictions)) {
|
|
throw new Error("predictions must be an array")
|
|
}
|
|
|
|
let isNsfw = false
|
|
|
|
Object.keys(minumunPredictions).forEach((key) => {
|
|
const prediction = predictions.find((prediction) => prediction.className === key)
|
|
|
|
if (prediction && prediction.probability >= minumunPredictions[key]) {
|
|
isNsfw = true
|
|
}
|
|
})
|
|
|
|
return isNsfw
|
|
} |