Ah yes, that smell of an unoccupied house full of food. I used to care for my parents during/after extended hospital visits.
Step 1: empty the trash and remove all unsealed food
Particularly fruits, vegetables, bread and other food material (which I call organic material even if it's conventionally grown) that is stored not in the refrigerator.
And when I say "organic material" I mean any food, drink, edible or body emission of any human or creature. It's all food to somebody, particularly pests.
Also clean the refrigator out of anything spoiled.
Keep emptying the trash and keep it span clean, literally sterile of food, at all times. If you have a banana for breakfast at 7am and throw the peel in the trash, then before you go to work at 7:30, that trash must be emptied into the outside bin by 7:30. Otherwise the flies will open a new family housing complex called Banana Rama. I'm sorry if that forces you to change lifelong habits, but you're on a mission.
Further, clean up any residual food on the trash can. If your trash can has old glops of food in the bottom or sides, then clean it up or get a new one. I thorw the cans in the shower and let the dirty parts soak for an hour, then they clean easily and I dump the residue in the toilet and flush.
Step 2: Freakish sterilization
At that point we're not just after food supply, we're after eggs.
The root problem is food. (And possibly organic aftermath from whatever caused the hospital visit; but I won't assume).
So this is a great time to remodel - well, won't take it that far - but certainly, to clean the kitchen to the level you'd do if you were a tenant and really wanted your deposit back. The freezer doesn't need to be touched, but other than that, cut a vicious swath - that stuff you've had for 5 months that you haven't eaten and realistically probably won't, off to trash/foodbank/etc. it goes. If you have daily staples that are well-sealed and that you really use at velocity, like the 3 jars of peanut butter left from the Costco 4-pack, then put em in a box and stick em in the garage. Meanwhile empty out the kitchen and sterilize it, scrubbed clean, range and fridge pulled out, whole nine yards. The police CSI team couldn't find evidence of food with their purple lights. that this kitchen was ever eaten in.
If you're one of those people who does oily frying and doesn't notice the deposits it leaves, get wise to it and take care of it. Also look for food residue in ovens and microwaves.
Scorched earth. No food residue of any kind, not even the stuff that's "too hard to get". The flies don't find it hard.
While this is happening, eat out of the freezer and don't make messes and don't fry. Take food scraps out immediately; either flush them down the disposal, or into the trash and the trash goes outside immediately after the meal.
The kitchen remains food-sterile except for the freezer, for the life cycle of a fly. They will starve and die.
It helps to dry them out by eliminating water sources.
Now, questions get a lot of Google traffic from others with similar problems, so let me touch on the hoarder issue for those other readers for whom it might be a factor. There are two kinds of hoarders: clutter hoarders and filth hoarders. Say there's an empty pizza box with some bits of cheese melted into it, and a couple of crusts. The clutter hoarder will make it a top priority to get rid of that, because it's future stink, rot and vermin, and that's a threat to the hoard. The filth hoarder will allow that to be subsumed into the ever-growing pile. This has a huge difference on vermin. In a filth-hoarder's home, the layers of accumulated organics will feed the flies forever, and the only viable option is to clean up the hoard completely, and do industrial, get-your-deposit-back cleaning like you see on the hoarder shows. The clutter-hoarder who has always done a good job of controlling organic materials can probably stop the flies with good cleaning, and is wise to act quickly, before outsiders get involved, because outsiders don't distinguish the two types.