KilonovaNet: Surrogate models of kilonova spectra with conditional variational autoencoders