Multi-class predictions - output individual probabilities?

Hi I posted the way I do this for text classification in this post here: How to output confidence of classiifcation models - #8 by adeperio