function to predict the labels