Spaces:
Sleeping
Sleeping
Commit ·
a9f361f
1
Parent(s): 512146e
changement adresse api pour Huggingface
Browse files- dashboard/dshbd.py +10 -3
dashboard/dshbd.py
CHANGED
|
@@ -11,10 +11,17 @@ load_dotenv(find_dotenv())
|
|
| 11 |
|
| 12 |
st.set_page_config(page_title="TechNova Dashboard", layout="centered")
|
| 13 |
|
| 14 |
-
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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"
|
|
|
|
| 11 |
|
| 12 |
st.set_page_config(page_title="TechNova Dashboard", layout="centered")
|
| 13 |
|
| 14 |
+
HF_SPACE = os.getenv("SPACE_ID") is not None
|
| 15 |
|
| 16 |
+
if HF_SPACE:
|
| 17 |
+
# pour Hugging Face
|
| 18 |
+
host = os.getenv("HOSTNAME", "")
|
| 19 |
+
API_BASE = f"https://{host}"
|
| 20 |
+
else:
|
| 21 |
+
# en local
|
| 22 |
+
API_BASE = os.getenv("API_BASE", "http://127.0.0.1:8000")
|
| 23 |
+
|
| 24 |
+
API_PREFIX = "/api"
|
| 25 |
|
| 26 |
API_PREDICT_BY_ID = f"{API_BASE}{API_PREFIX}/predict/by-id"
|
| 27 |
API_PREDICT_DEBUG = f"{API_BASE}{API_PREFIX}/predict/debug"
|