http://ipm.ucanr.edu/PMG/PESTNOTES/pn7448.html
And I quote:
Trapping
In home situations where fungus gnat adults are a nuisance, it may be possible to reduce the problem by using sticky traps available at retail nursery and garden centers. Yellow sticky traps can be cut into smaller squares, attached to wooden skewers or sticks and placed in pots to trap adults. Also, raw potato chunks placed in the soil are very attractive to fungus gnat larvae. These may be used not only to check pots for larvae but also to trap them away from plant roots. After a few days in a pot, remove infested chunks, dispose of them, and replace with fresh ones.