I managed to fix this issue by upgrading Pillow to Pillow==9.3.0 Also by creating a runtime.txt file and using python version python-3.11
Pillow==9.3.0
runtime.txt
python-3.11