How to compute accuracy and precision for each class in text classification task?

I have this:

But I need something like this:
precision
0 0.962
1 0.516