I agree with Sheryl. It sounds to me like your compost mix may be way too heavy and is retaining too much moisture. Fungus Gnats are usually present when the soil stays wet. I've been growing house plants for 45 years and for the past ten or twelve years I've been using a fast draining potting medium that consists of orchid bark mix and potting soil which doesn't allow the soil to stay drenched. I've never had a problem with fungus gnats so I can't attest to any remedy, but I've also heard of folks mixing hydrogen peroxide with water or putting a layer of some sort of grit on top of the soil to prevent the eggs that hatch from reaching adulthood and the flying stage.