Skip to content

Support more content types for the NSFWProtector #594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

Half-Shot
Copy link
Contributor

@Half-Shot Half-Shot commented Mar 25, 2025

In order to work around the limitations of tensorflow's models, this PR transcodes anything that might look like an image or video into something we can then pass through the model.

Tested and working.

The list of improvements are:

  • Non-standard image types and video types are now thumbnailed.
  • We cache the result of the last classification so repeat media are quickly deleted.
  • Models have been updated.
  • It's possible to specify the model you'd like to run with in the config.

@Half-Shot Half-Shot marked this pull request as ready for review April 1, 2025 12:12
@Half-Shot Half-Shot requested a review from a team as a code owner April 1, 2025 12:12
@Half-Shot Half-Shot changed the title Experimenal support for better NSFW detection via type conversion Support more content types for the NSFWProtector Apr 1, 2025

/**
* Extract the first frame from a video or image source.
* @param ffmpegPath The path to the `ffmpeg` binary.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it pull from somewhere in the first third-middle? Just wondering if always pulling from first frame will be easily evaded.

LogService.warn("NsfwProtection", `No content type header specified`);
return null;
}
console.log(contentType);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if this is a stray from debugging :)

Copy link
Contributor

@H-Shay H-Shay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome, just had one question. Otherwise I would love to see a test or two of new functionality but am not going to gate approval behind that :)

@H-Shay
Copy link
Contributor

H-Shay commented Jun 12, 2025

@Half-Shot just curious about the status on this? I think we can probably merge it but I've lost context and want to make sure there's nothing I am forgetting.

@Half-Shot
Copy link
Contributor Author

Hey @H-Shay, I'm mostly happy with this but I want to do more testing before we merge. I can take a look this afternoon.

@Half-Shot Half-Shot self-assigned this Jun 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants