high bro, try top dressing your soil with diatomaceous earth.
you can find it at Lowes and Home Depot as well as most garden stores.
it cost's about $8.00 or so for a bag that will last years unless you're a
commercial grower.

what it is exactly is ground up shells, ground up into very tiny, very sharp
pieces which kill those fungus gnats (that's what those little flies are btw)
without harsh chemicals.

btw, unless you have a very severe infestation, those gnats are more a pain
in the ass rather than a real worry.