How close are we to replacing pilots with computers?
In some ways, this has already happened in some limited areas.
Flight Engineers and Navigators
As a precursor to replacing pilots, we have already replaced non-pilot crew on the flight deck. The flight engineer role has been replaced largely by computerized engine systems.
A significant problem for the remaining pilots can be maintaining their skills during their time in the cockpit when they spend long hours mostly monitoring systems rather than doing hands-on piloting.
I suspect, a lot of what commercial and military pilots do boils down to issuing commands to computers, rather than manually (if indirectly) moving control surfaces.
In the first gulf war, 297 missions were flown by autonomous aircraft. Many explosive payloads were delivered to targets by small aircraft that flew hundreds of km. These navigated and flew without any on-board or remote human pilot controlling them. Cruise missiles.
The alternative would presumably have been greater numbers of human pilots in conventional bombers dropping smart bombs over the target.
Ground attack pilots
Some jobs that would have been carried out by a pilot inside a ground-attack aircraft are now carried out by a UCAV with a remote pilot. These UCAVs have increasing amounts of autonomy. Some are intended to have full autonomy. It isn't hard to envisage a not too distant scenario where the main human interaction with the aircraft is not piloting it, but authorizing firing of weapons.
Jobs like power-line inspection are, in some remote areas, mostly carried out from helicopters with human pilots but we seem to be on the brink of replacing some of those pilots with drones. That seems a few technically short steps from using autonomous drones. The main time-consuming barrier is probably regulatory change.
Currently, to operate a drone for this purpose, you don't need to be a licensed pilot. Is such a drone operator a pilot. Have they replaced one?
As others have answered, nowhere near.