How?
If you really must, you can simply have the AI auto delete nsfw images, several already do this. Now to argue you can’t simply never generate or give out nsfw images, you can also gate nsfw content generation behind any number of hinderences that are highly effective against anonymous use, or underage use.
Modern AI is not capable of this. The accuracy for detecting nsfw content is not good, and they are completely incapable of detecting when nsfw content is allowable because they have no morals and they don’t understand anything about people or situations besides appearance.
These models are also already open sourced, you can’t stop it. Additionally all of those “requirements” would just mean that AI would only be owned by big corporations.
I think that’s one thing that’s often forgotten in these conversations. The cat’s out of the bag, you will never be able to stop the generation of things as they are right now. You’ll just be able to punish people for doing so.