How to use Gibbs samples for inference in Probabilistic Matrix Model?

The example use variational inference

How do I use gibbs sampling to do the same thing?

I highly recommend https://github.com/dadaromeo/recsys-hpf. It uses Edward to do Monte Carlo EM (Gibbs sampling + MAP) for hierarchical Poisson factorization. (this is one of the SOTA recommender system models)