Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -108,8 +108,13 @@ app.add_middleware(
|
|
| 108 |
secret_key=SESSION_SECRET,
|
| 109 |
session_cookie="hp_session",
|
| 110 |
max_age=60 * 60 * 24 * 30, # 30 days
|
| 111 |
-
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
)
|
| 114 |
|
| 115 |
|
|
|
|
| 108 |
secret_key=SESSION_SECRET,
|
| 109 |
session_cookie="hp_session",
|
| 110 |
max_age=60 * 60 * 24 * 30, # 30 days
|
| 111 |
+
# On HF Spaces the dashboard runs inside an iframe at huggingface.co, so
|
| 112 |
+
# the Space's own cookies are "cross-site" relative to the parent page.
|
| 113 |
+
# SameSite=None + Secure is the only combination browsers allow in that
|
| 114 |
+
# context. We toggle based on OAuth being configured (i.e. deployed to a
|
| 115 |
+
# real Space) so local dev keeps working over plain HTTP.
|
| 116 |
+
same_site="none" if OAUTH_CLIENT_ID else "lax",
|
| 117 |
+
https_only=bool(OAUTH_CLIENT_ID),
|
| 118 |
)
|
| 119 |
|
| 120 |
|