Yeah I think the generator is the best bet too. I don’t know that you could find anything affordably that would power something for four or five hours.
Not sure of any UPS that can do this. UPSs are usually designed to give you a few minutes to either avoid damage from flash blackouts/brownouts (lasting a few seconds), power outages where you need to turn off a powerful device and restore power in the switchboard, or to simply turn off your computer normally following a lasting blackout. If you need something that lasts few hours, even for a modest computer system, I don’t see how it will be smaller than the engine block of a truck and cost less than a small fortune.
UPS or Invertor will take of your PC for 7 -8 hrs but that will be little bit pricey at about 25k to 40k. What I can suggest to you is get a laptop and then a inverotr for 25K . Laptop battery should take care of two hours powercut the rest invertor will take care.
It all depends on battery and wattage
For a PC , fan and light you will require - 700VA or 700W
For a laptop, fan and light - 300 - 400Va
Plus battery. Check in a nearest city of yours for more info.