move thumbnail generation away from flask