Buy a pest spray from Homebase or B&Q or similar, which is especially for houseplants - or, more eco-friendly, make up a dilute spray of water and washingup liquid, and spray it on the plants. Spray lightly, don't drown the plant.
I'd take them outside and wash the flies off. If the plants will stand it, spray with a hose pipe, if not be more gentle but thorough. Then i'd take the top inch of soil out and replace it.