First, you’ve got to find the food source they are eating, otherwise if you get rid of them, they’ll just be back. For very small flies, it could be something you wouldn’t expect, like a container of grain/rice/cereal that they are able to get into. For bigger ones, it could be a dead mouse or something like that in your walls or basement that they are feeding off of.
Once you get rid of whatever they are eating, and make sure there isn’t any other food they can get to, then they will die off pretty quick. If you need to get rid of them faster, you can just fog up the rooms where they are with flying insect spray, and leave them closed up for a few hours. Then, just make sure that you ventilate those parts of your house for 6-8 hours before you go back in there, so you don’t make yourself sick. Also, make sure to rinse off kitchen countertops, stove, pots & pans, etc if you spray in the kitchen, because you don’t want that stuff getting in your food.
The low tech solution I have used:
1. Get a plastic grocery bag without any small holes in it
2. Put a small amount of smelly fruit peels and such in it
3. Let bag stand upright and open
4. After 15 minutes grab and close the top of the bag with your hand
5. Slowly push the air out of the top and squish the flies inside the bag with your fingers. This is fun and your hands remain clean because there are no holes in the plastic
6. Reopen the bag and stand it upright and open
7. Repeat over and over. Soon you will find fewer and fewer are caught each time as the population in the area goes down.