Machine learned potentials for theoretical spectroscopy of molecules in solvent