Are these floors salvageable?

Recently bought a house that had (old grungy) carpet installed over hardwood floors and the floors look decent in places but have stains and other imperfections like slight gaps between boards. Im curious whether these floors will look good once sanded and refinished or whether these imperfections may be too severe to make it worth trying to refinish them?