Found this statement on a MA waste website:
After reading it, a few months back, decided that if I add several carnivorous sundews, butterworts, and fly traps which sit in floating moss bogs in pure water, that would be an effective trap for fungus gnats. Regular fruit flys which I seem to have several due to me eating a banana each day are apparently easily captured with a vinegar trap (open jar with vinegar and two drops of dish detergent) My butterworts are covered with fruit flies right now, so I haven't tried to install the vinegar trap for fear of starving the plants!
Here's the article pasted below:
How to Control Fruit Flies & Fungus Gnats
Fruit flies and fungus gnats are the most common flying insects found in and around compost bins. These insects are not dangerous or harmful; however, their presence can be a nuisance, particularly indoors. A little information about the food and environments these insects are attracted to can be used to help us control their presence in places where they are not wanted.
There are many species of fruit flies, ranging in size from one to two millimeters. They can be recognized by the rather bulbous shape of their lower bodies, which is frequently an orange or light brown color. They are relatively slow flyers, often hovering around fruit or juice.
Indoor compost bins (worm bins) provide favorable conditions for the reproduction of these insects, but occasionally fruit flies seem to appear in our kitchens as if by spontaneous generation, even without the presence of a worm bin. This is because they can travel into our homes, unbeknownst to us, as larvae on the fruit we buy. The adults lay their eggs, invisible to the naked eye, on bananas and other fruits, which later hatch while the fruit is in our fruit bowls. If we put fruit skins containing fruit fly larvae into our worm bins, we soon have a healthy population of fruit flies in and around the worm bin. It is advisable not to add any more food to the worm bin until the fruit flies are gone. Since banana peels seem to be the most common bearer of fruit fly larvae, some people prefer to compost banana peels in outdoor bins only.* Banana peels are also beneficial to rose bushes as a source of potassium and can be buried directly into the soil around the plants (not more than three skins per rose bush per week).
Fortunately, fruit flies have an excellent sense of smell and are strongly attracted by bananas. A simple, nontoxic, inexpensive, humane way to trap them is to place a banana peel inside a clear plastic container and make three or four holes in the cover with a standard round toothpick. Be sure to pull the toothpick all the way through the plastic and wiggle it around to make a hole large enough for a fruit fly to crawl through. Place the plastic container in or near the fruit bowl, not inside the worm bin. (If the worm bin is not in your kitchen, place the fruit fly trap on a surface above the worm bin; if it is inside or too close to the worm bin, the odor of the banana peel will not be distinct enough to attract the fruit flies as effectively). Within 24 hours, about 99 percent of the fruit flies will be inside the plastic container, having entered the holes and not found their way out. Each day, take the container outside and release the fruit flies, unless you are a biology teacher or entomologist and want them for genetics experiments. After three or four days, the fruit flies will be gone (if no additional banana peels or other potential source of larvae have been added to the worm bin).
Some species of fruit flies are larger than others. If you see fruit flies crawling around on the surface of your plastic container but not going inside, make the holes larger.
* If fruit flies become a nuisance in an outdoor compost bin, this indicates that the ratio of food scraps to high carbon material is too high. Add enough high carbon materials, such as brown leaves, shredded paper or cardboard, until this material comprises at least 50 percent of the total material in the bin. Try to keep about 12 inches of high carbon material on the surface of your pile, under which the food scraps are buried.
Fungus gnats are also members of the fly family, usually about 1 millimeter in size. They can be recognized by their all-black, rather "skinny" bodies, compared to that of fruit flies, and their "gnatlike" manner of flying. They can sometimes be observed crawling on the bedding in a worm bin, often while mating. They seem to be attracted to light, because their bodies can often be found on window sills.
Fungus gnats are attracted to moisture and fungus, and are therefore attracted to compost bins, indoors or out. The soil in which houseplants are potted can also provide an environment in which fungus gnats can flourish, so they may be found indoors even when there is no indoor compost bin. They may be frequently seen around outdoor compost piles, but they stay in the vicinity of the compost, so aren't normally considered a nuisance.
There currently seems to be no method for trapping fungus gnats. Instead, their presence can be controlled by eliminating what attracts them, moisture and fungus, from the area where the gnats are not wanted. Since both moisture and fungus are important elements of the composting process, they must not be eliminated entirely. One option that is quite effective is to keep the indoor compost bin uncovered and let the top layer of bedding dry out, while keeping the layers beneath at the 50 percent moisture necessary for active composting. This way, the fungus gnats tend to stay below the surface of the worm bin, where it is damp, and don't venture up to the surface enough to be noticeable.
If fungus gnats seem to be coming from your houseplants, this may indicate too much moisture. Try letting the plants dry out a little more.