Working Outside of Application Context Error in Flask for Hops Component

Hallo,

I am trying to create a Hops component that is able to load a pre-trained surrogate model and predict cooling energy demand. I came into this error that apparently comes from Flask. I have added a few lines on my script with app.app_context() but the error is still there.

The error message in GH is like this:

I have added a few lines on my script (highlighted) but the error is still there.

Any idea to resolve this?
Thank you!

Best,
Felita