ajit3259 commited on
Commit
33782c8
·
1 Parent(s): aafbcb7

fix: auto-disable LM Studio on HF Spaces via SPACE_ID detection

Browse files
Files changed (1) hide show
  1. config.py +3 -2
config.py CHANGED
@@ -9,8 +9,9 @@ UPLOADS_DIR = Path(os.getenv("UPLOADS_DIR", str(_data_dir / "uploads")))
9
 
10
  SCREENSHOTS_DIR = os.getenv("SCREENSHOTS_DIR", str(Path.home() / "Desktop"))
11
 
12
- # PATH A — LM Studio (local dev). Set LM_STUDIO_URL="" to switch to PATH B.
13
- LM_STUDIO_URL = os.getenv("LM_STUDIO_URL", "http://localhost:1234/v1")
 
14
  LM_MODEL = os.getenv("LM_MODEL", "")
15
 
16
  # PATH B — HF Transformers (used when LM_STUDIO_URL is not set)
 
9
 
10
  SCREENSHOTS_DIR = os.getenv("SCREENSHOTS_DIR", str(Path.home() / "Desktop"))
11
 
12
+ # PATH A — LM Studio (local dev). Auto-disabled on HF Spaces (SPACE_ID is set there).
13
+ _default_lm_url = "" if os.getenv("SPACE_ID") else "http://localhost:1234/v1"
14
+ LM_STUDIO_URL = os.getenv("LM_STUDIO_URL", _default_lm_url)
15
  LM_MODEL = os.getenv("LM_MODEL", "")
16
 
17
  # PATH B — HF Transformers (used when LM_STUDIO_URL is not set)