It depends on what type of gnat you are seeing. Most gnats will hatch in water.
Drain flies, come from your drain.
I find that the best way to rid my home of these unwanted guest to to add some drain cleaner to my sinks and tub just before we go to bed.
You will notice the flies/gnats gone in just one day as most only live one day as an adult.