Duplicated from polejowska/vicellst-attention
3370ff8 969f7a7
1
2
3
4
5
6
7
8
9
10
import io from PIL import Image def fig2img(fig): buf = io.BytesIO() fig.savefig(buf) buf.seek(0) return Image.open(buf)