Spaces:
Running on Zero
Running on Zero
Update description
Browse files
app.py
CHANGED
|
@@ -6,6 +6,15 @@ from pathlib import Path
|
|
| 6 |
# Suppress HF model download progress bars (hundreds of lines on cold start)
|
| 7 |
os.environ.setdefault("HF_HUB_DISABLE_PROGRESS_BARS", "1")
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
# Add paths for imports BEFORE importing anything else
|
| 10 |
_app_path = Path(__file__).parent.resolve()
|
| 11 |
sys.path.insert(0, str(_app_path))
|
|
|
|
| 6 |
# Suppress HF model download progress bars (hundreds of lines on cold start)
|
| 7 |
os.environ.setdefault("HF_HUB_DISABLE_PROGRESS_BARS", "1")
|
| 8 |
|
| 9 |
+
# Load .env file for local dev (HF_TOKEN for private model access)
|
| 10 |
+
_env_path = Path(__file__).parent / ".env"
|
| 11 |
+
if _env_path.exists():
|
| 12 |
+
for _line in _env_path.read_text().splitlines():
|
| 13 |
+
_line = _line.strip()
|
| 14 |
+
if _line and not _line.startswith("#") and "=" in _line:
|
| 15 |
+
_key, _val = _line.split("=", 1)
|
| 16 |
+
os.environ.setdefault(_key.strip(), _val.strip())
|
| 17 |
+
|
| 18 |
# Add paths for imports BEFORE importing anything else
|
| 19 |
_app_path = Path(__file__).parent.resolve()
|
| 20 |
sys.path.insert(0, str(_app_path))
|