Gnats seem to find their way into any nook and cranny that interests them. Be it summer or winter, if a source of food is there, they appear with an increasing multiplicity. You'll have to get rid of their food source and use some chemicals to eradicate them, but in time you can defeat these pesky bugs.
Step one to getting them out of your home is to remove their food supply. Your fruits and vegetables need to be sealed and covered. This means placing them in the refrigerator or in some sort of sealable bin, which they cannot penetrate. House plants can also be a site of attraction, especially if water has pooled around it—make sure the plants are watered but have adequate drainage. Garbage receptacles and recycling bins can also interests these small winged pests.
There are a few home remedies available to those struggling with gnats. Gnats are attracted to vinegar-based odors. Try placing vinegar in a jar, and covering the lid with a tight fitting plastic or lid, which you can punch holes into. The gnats will follow the scent to the jar, climb into the holes, but not be able to make it back out (there are commercial versions of this device).
After eliminating those things that interest them, the next step is a form of chemical control. Grocery stores and Home and Garden Centers, offer a host of different control methods: tapes, sprays, and other chemicals. Look into the one that best fits your needs and follow the supplied instructions. There are also chemical foggers, but this should be a last resort. If this is your only option, make sure to carefully read the instructions, and to remove yourself and your pets from the house during the treatment time.
With patience and diligence you will be able to get rid of the gnats in your home. You may have to sacrifice a few luxuries like not leaving those dirty dishes out all night, or letting your fruits ripen on the counter top, but it is well worth it, to rid your house of those pesky little nuisances.