Put 1/2" of cider vinegar in a few cups with 5 drops of dish soap in them. If they are fruit flies these cups catch most of them in a couple of days. If they are fungus gnats, spray down the soil of any house plants you have with pyretherin (sp) or a soil drench. These work great for me when I get gnats or flies.

Edit: Kristy beat me to the vinegar. See, it works.