MogensR commited on
Commit
5bccacc
·
1 Parent(s): 626e708

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -31
app.py CHANGED
@@ -1,37 +1,7 @@
1
  #!/usr/bin/env python3
2
- # app.py — process entrypoint
3
-
4
- # 1) Fix OMP/BLAS envs early (prevents libgomp crash)
5
- import os, sys
6
- if not os.environ.get("OMP_NUM_THREADS", "").strip().isdigit():
7
- os.environ["OMP_NUM_THREADS"] = "2"
8
- os.environ.setdefault("MKL_NUM_THREADS", "2")
9
- os.environ.setdefault("OPENBLAS_NUM_THREADS", "2")
10
- os.environ.setdefault("NUMEXPR_NUM_THREADS", "2")
11
-
12
- # Make repo root importable
13
  sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
14
 
15
- # 2) Optionally tame Torch threads early (best effort)
16
- try:
17
- import torch
18
- if os.environ.get("TORCH_NUM_THREADS") is None:
19
- torch.set_num_threads(2)
20
- if os.environ.get("TORCH_NUM_INTEROP_THREADS") is None:
21
- torch.set_num_interop_threads(2)
22
- except Exception:
23
- pass
24
-
25
- # 3) Launch quiet self-check (threaded) BEFORE app UI starts
26
- try:
27
- from tools.self_check import launch_self_check_async
28
- launch_self_check_async() # honors DISABLE_SELF_CHECK
29
- except Exception as e:
30
- # Do not fail startup if self-check wiring has issues
31
- import logging
32
- logging.getLogger(__name__).warning(f"Self-check launch skipped: {e}")
33
-
34
- # 4) Now import and launch the app
35
  from core.app import main
36
 
37
  if __name__ == "__main__":
 
1
  #!/usr/bin/env python3
2
+ import sys, os
 
 
 
 
 
 
 
 
 
 
3
  sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  from core.app import main
6
 
7
  if __name__ == "__main__":