A great way to get rid of gnats on your houseplants is to mix 32 ounces of water with one squirt of Windex. Water your plants by making sure the entire soil surface is wet. It's not necessary to saturate the soil.
I got excited when I first saw this. We grow a lot of food indoors and sometimes have issues with gnats. On further consideration, I'm not sure this would be a safe solution where food is involved.