The only thing to do is to either put the fruit into an enclosed space where the flies can't get to them, they might need rinsing to get rid of any eggs or put them outside! They are such a nuisance.
Keep your fruit in the fridge. Keep all other food covered or out of the room while you ..... Spray area quickly with fly spray .. I know, its poisonous but it works. Leave the room and shut the door. Pick them up five minutes later and open the window slightly for some fresh air ... good luck !