Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
|
@@ -1,9 +1,6 @@
|
|
| 1 |
# main.py — ASGI entrypoint for BubbleGuard Web (HF-ready, with GDrive fetch)
|
| 2 |
-
# Author: Amir
|
| 3 |
|
| 4 |
-
import os
|
| 5 |
-
import sys
|
| 6 |
-
import traceback
|
| 7 |
|
| 8 |
def _truthy(val: str) -> bool:
|
| 9 |
return str(val).strip().lower() in {"1", "true", "yes", "on"}
|
|
@@ -15,21 +12,16 @@ def main() -> None:
|
|
| 15 |
|
| 16 |
print(f"[BubbleGuard] Starting server on {host}:{port}")
|
| 17 |
folder_id = os.getenv("GDRIVE_FOLDER_ID", "").strip()
|
| 18 |
-
|
| 19 |
-
print(f"[BubbleGuard] Using Google Drive folder: {folder_id}")
|
| 20 |
-
else:
|
| 21 |
-
print("[BubbleGuard] No GDRIVE_FOLDER_ID set (will fail to load assets).")
|
| 22 |
|
| 23 |
-
# Ensure assets before importing the app
|
| 24 |
try:
|
| 25 |
from download_assets import ensure_all_assets
|
| 26 |
ensure_all_assets()
|
| 27 |
-
except Exception
|
| 28 |
print("[BubbleGuard] ERROR while preparing assets:", file=sys.stderr)
|
| 29 |
traceback.print_exc()
|
| 30 |
raise SystemExit(1)
|
| 31 |
|
| 32 |
-
# Start Uvicorn after assets are ready
|
| 33 |
try:
|
| 34 |
import uvicorn
|
| 35 |
uvicorn.run(
|
|
|
|
| 1 |
# main.py — ASGI entrypoint for BubbleGuard Web (HF-ready, with GDrive fetch)
|
|
|
|
| 2 |
|
| 3 |
+
import os, sys, traceback
|
|
|
|
|
|
|
| 4 |
|
| 5 |
def _truthy(val: str) -> bool:
|
| 6 |
return str(val).strip().lower() in {"1", "true", "yes", "on"}
|
|
|
|
| 12 |
|
| 13 |
print(f"[BubbleGuard] Starting server on {host}:{port}")
|
| 14 |
folder_id = os.getenv("GDRIVE_FOLDER_ID", "").strip()
|
| 15 |
+
print(f"[BubbleGuard] GDRIVE_FOLDER_ID: {folder_id or '(not set!)'}")
|
|
|
|
|
|
|
|
|
|
| 16 |
|
|
|
|
| 17 |
try:
|
| 18 |
from download_assets import ensure_all_assets
|
| 19 |
ensure_all_assets()
|
| 20 |
+
except Exception:
|
| 21 |
print("[BubbleGuard] ERROR while preparing assets:", file=sys.stderr)
|
| 22 |
traceback.print_exc()
|
| 23 |
raise SystemExit(1)
|
| 24 |
|
|
|
|
| 25 |
try:
|
| 26 |
import uvicorn
|
| 27 |
uvicorn.run(
|