Paul Clark Claude Opus 4.7 (1M context) commited on
Commit Β·
8a60dfe
1
Parent(s): 1e9cee1
feat: gate training behind TRAIN_ENABLED env var so Space restarts don't auto-train
Browse files- training_space/app.py +6 -3
training_space/app.py
CHANGED
|
@@ -329,9 +329,12 @@ ul{{line-height:1.8}}
|
|
| 329 |
|
| 330 |
# ββ Entry point βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 331 |
if __name__ == "__main__":
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
|
|
|
|
|
|
|
|
|
| 335 |
|
| 336 |
# Serve status page on port 7860 (HF Spaces default)
|
| 337 |
server = HTTPServer(("0.0.0.0", 7860), StatusHandler)
|
|
|
|
| 329 |
|
| 330 |
# ββ Entry point βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 331 |
if __name__ == "__main__":
|
| 332 |
+
if os.environ.get("TRAIN_ENABLED", "").lower() in ("1", "true", "yes"):
|
| 333 |
+
thread = threading.Thread(target=train, daemon=True)
|
| 334 |
+
thread.start()
|
| 335 |
+
else:
|
| 336 |
+
_status = "Idle β training disabled. Set TRAIN_ENABLED=1 to start."
|
| 337 |
+
_log("Training disabled (TRAIN_ENABLED not set). Serving status page only.")
|
| 338 |
|
| 339 |
# Serve status page on port 7860 (HF Spaces default)
|
| 340 |
server = HTTPServer(("0.0.0.0", 7860), StatusHandler)
|