A two-component model of the solar photosphere from the inversion of spectral lines