Would it be ethical to use AI to determine a user’s gender from the content they upload, without them knowing?

I’ve been thinking about this for a few days and can’t tell if this would feel morally just to an average user