Skip to content

Commit

Permalink
Debug 15
Browse files Browse the repository at this point in the history
  • Loading branch information
fabasoad committed Jan 3, 2025
1 parent c0d836a commit eb89d89
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/compare-with-threshold.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ compare_with_threshold() {
threshold="${2}"
file_path="${3}"

result=$((threshold - score))
if awk -v r="${result}" 'BEGIN {exit !(r < 0)}'; then
if awk -v t="${threshold}" -v s="${score}" 'BEGIN {exit !((t - s) < 0)}'; then
log_error "NSFW content detected in ${file_path} with score ${score}."
exit 1
elif awk -v r="${result}" 'BEGIN {exit !(r > 0.3)}'; then
elif awk -v t="${threshold}" -v s="${score}" 'BEGIN {exit !((t - s) > 0.3)}'; then
log_info "No NSFW content detected in ${file_path} with score ${score}."
else
log_warning "${file_path} with score ${score} is close to be considered as NSFW content."
Expand Down

0 comments on commit eb89d89

Please sign in to comment.