I'm struggling with a Tensorflow operation that fails when executed in a Web App, but runs without problems from a pythonanywhere console.
Here is the code (simplified):
path_to_img = 'static/images/content.jpg' max_dim = 512 img = tf.io.read_file(path_to_img) img = tf.image.decode_image(img, channels=3) logging.info('checkpoint 1') img = tf.image.convert_image_dtype(img, tf.float32) logging.info('checkpoint 2')
From the logging I can see that checkpoint 1 is reached, but checkpoint 2 is not. So the execution hangs at
img = tf.image.convert_image_dtype(img, tf.float32)
Locally, this code runs fine (also in a Flask app). Moreover, in a pythonanywhere console I can run it without issues. Only from within a pythonanywhere Web App it fails. What is the issue here?