Reconstructing porous media using generative flow networks