Mosquito Dunks are sold at most hardware/home improvement stores. These are little doughnut shaped disks that float in water and contain Bacillius thuringiensis israelensis bacterium which is released steadily for a period of 30 days. The bacteria produces a larvicidal toxin, it will be consumed by the fungus gnats and they will die. It could take a few weeks, but the populations will be significantly reduced.
In the mean time you can consider other control methods to keep the adult population down. These can include sticky strips, insecticidal sprays and/or repellents (Go-Gnats, neem oil, Organocide, pyrehtrins, Cinnamon oil extracts) or even vacuum as many of them up as you can.