Spaces:
Running

aditya-rAj19 commited on
Commit
e522792
·
1 Parent(s): 27bac33

Turn Flask debug OFF by default and pre-warm models without blocking startup

Browse files

Nothing sets FLASK_DEBUG in the Dockerfile, startup.sh or the Space config, and
both reads defaulted it to "true" — so the deployed Space served the Werkzeug
interactive debugger on the public internet, and CORS took the localhost-only
dev branch instead of the intended production one.

The default is now off (opt in locally with FLASK_DEBUG=true), which also means
_prewarm_models() no longer gets skipped, so the first swap doesn't pay for
loading buffalo_l + inswapper + GFPGAN on the request path. It runs in a daemon
thread so the port still binds immediately — startup.sh backgrounds the model
downloads for exactly that reason, since HF kills a container that doesn't
answer on its port within ~60s.

Verified locally: "Debug mode: off", port bound while the pre-warm ran, and
/api/locations served 200 during it.

1 file changed +11 -4
web_app.py+11-4