If the goal is simply to allow you to eliminate mortgage insurance, you're almost certainly better off using whatever budget you have to pay down the debt than to try to improve the appraised price of the house. It is rare for any home improvement project to increase the appraised price of the home more than the cost of the project itself. There are sites that will let you estimate the payback rate but you'll be hard-pressed to find anything that increases the property value by as much as you're paying. Sending the bank $4,000, on the other hand, is guaranteed to reduce your balance by $4,000.
Even if the appraised value goes up by the cost of the project, you're better off paying down the mortgage. Say that your house is currently worth $100,000, you owe $80,000, and that spending $4,000 replacing the floors increases the appraised value to $104,000. Starting off, your loan-to-value (LTV) is 80% (80,000/ 100,000). If you replace the floors, your LTV is 76.9% (80,000/ (100,000 + 4,000) ). If you make an additional payment, your LTV is 76% ( (80,000 - 4,000)/ 100,000 ). In order to get an equal reduction in the LTV, you'd need the appraised value to go up by (1/ starting LTV) times the cost of the project. So in this case, you'd need the project to increase the value of the home by 125% (1/ 0.80) just to get the same LTV benefit you'd get from making an additional payment. That is going to be a very, very high bar to clear.
Of course, if you personally prefer hardwood floors, it's entirely reasonable to take that into account. If you get some consumption value from the project and you recoup some value by getting closer to eliminating mortgage insurance, it may make more sense to replace the carpets rather than writing the bank a check even if that doesn't make sense from the standpoint of purely removing the insurance.