SteGONZALEZ commited on
Commit
73c2d5d
·
1 Parent(s): a0ccd53

changement dachboard pour chemin api

Browse files
Files changed (2) hide show
  1. .coverage +0 -0
  2. dashboard/dshbd.py +9 -10
.coverage CHANGED
Binary files a/.coverage and b/.coverage differ
 
dashboard/dshbd.py CHANGED
@@ -11,16 +11,15 @@ load_dotenv(find_dotenv())
11
 
12
  st.set_page_config(page_title="TechNova Dashboard", layout="centered")
13
 
14
- # ===== IMPORTANT (HF single-container + nginx) =====
15
- # - En prod HF (1 conteneur), l’API est routée via Nginx sous /api
16
- # - Donc, par défaut, on appelle la même origin + "/api/..."
17
- # - En local, tu peux surcharger via API_BASE=http://127.0.0.1:7860 (si nginx) ou API_BASE=http://127.0.0.1:8000 (si uvicorn direct)
18
- API_BASE = os.getenv("API_BASE", "") # ex: "http://127.0.0.1:8000" en local, sinon "" sur HF
19
-
20
- API_PREDICT_BY_ID = f"{API_BASE}/api/predict/by-id"
21
- API_PREDICT_DEBUG = f"{API_BASE}/api/predict/debug"
22
- API_LATEST = f"{API_BASE}/api/predictions/latest"
23
- API_ROOT = f"{API_BASE}/api/"
24
 
25
  # API key (le dashboard est un client HTTP, il envoie seulement le header)
26
  API_KEY = os.getenv("API_KEY")
 
11
 
12
  st.set_page_config(page_title="TechNova Dashboard", layout="centered")
13
 
14
+ API_BASE = os.getenv("API_BASE", "").rstrip("/") # "" sur HF, "http://127.0.0.1:8000" en local
15
+
16
+ # Si API_BASE est vide => on passe par nginx => /api/...
17
+ API_PREFIX = "/api" if API_BASE == "" else ""
18
+
19
+ API_PREDICT_BY_ID = f"{API_BASE}{API_PREFIX}/predict/by-id"
20
+ API_PREDICT_DEBUG = f"{API_BASE}{API_PREFIX}/predict/debug"
21
+ API_LATEST = f"{API_BASE}{API_PREFIX}/predictions/latest"
22
+ API_ROOT = f"{API_BASE}{API_PREFIX}/"
 
23
 
24
  # API key (le dashboard est un client HTTP, il envoie seulement le header)
25
  API_KEY = os.getenv("API_KEY")