Measuring the spectral index of turbulent gas with deep learning from projected density maps