Code used for predictions API