Spaces:
Running
Running
| import os | |
| PORT = int(os.environ.get("PORT", "7860")) | |
| TOKEN = os.environ.get("JUPYTER_TOKEN", "") | |
| c.ServerApp.ip = "0.0.0.0" | |
| c.ServerApp.port = PORT | |
| c.ServerApp.open_browser = False | |
| c.ServerApp.allow_root = True | |
| c.ServerApp.allow_remote_access = True | |
| # Show your repo contents | |
| c.ServerApp.root_dir = "/work" | |
| # Make the Space load JupyterLab directly (instead of a blank / page) | |
| # Change this path to your repo folder name if needed. | |
| c.ServerApp.default_url = "/lab/tree/Split-Skip-and-Play" | |
| # Allow embedding in the Hugging Face Space page iframe | |
| c.ServerApp.tornado_settings = { | |
| "headers": { | |
| "Content-Security-Policy": "frame-ancestors *" | |
| } | |
| } | |
| # Cookies in an iframe need SameSite=None; Secure | |
| c.ServerApp.cookie_options = {"SameSite": "None", "Secure": True} | |
| # In iframe contexts, browsers sometimes drop the xsrf cookie; this avoids kernel-start failures. | |
| # IMPORTANT: keep a token (JUPYTER_TOKEN) if your Space is public. | |
| c.ServerApp.disable_check_xsrf = True | |
| # Require token if provided (set this in Space Settings -> Secrets) | |
| c.ServerApp.token = TOKEN | |