UI: read backend URL from env only, not user input
Browse files- ui/auto_tune_ui.py +21 -12
ui/auto_tune_ui.py
CHANGED
|
@@ -72,25 +72,34 @@ with st.sidebar:
|
|
| 72 |
st.header("Run configuration")
|
| 73 |
|
| 74 |
# ---- Backend mode (Local subprocess vs remote GPU server) ----
|
| 75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
backend_mode = st.radio(
|
| 77 |
"Backend",
|
| 78 |
options=("Local subprocess", "Remote GPU server"),
|
| 79 |
-
index=1 if
|
| 80 |
help=(
|
| 81 |
-
"Local: launches scripts/auto_tune.py
|
| 82 |
-
"Remote: POSTs to /auto-tune on
|
| 83 |
-
"the
|
| 84 |
),
|
| 85 |
)
|
| 86 |
-
backend_url = ""
|
| 87 |
if backend_mode == "Remote GPU server":
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
st.divider()
|
| 96 |
workload_source = st.radio(
|
|
|
|
| 72 |
st.header("Run configuration")
|
| 73 |
|
| 74 |
# ---- Backend mode (Local subprocess vs remote GPU server) ----
|
| 75 |
+
# The remote URL comes from the GOBLIN_AUTO_TUNE_URL env var only —
|
| 76 |
+
# NOT exposed as a user input. On the deployed HF Space this is set
|
| 77 |
+
# via Settings → Variables and secrets and points at the operator's
|
| 78 |
+
# MI300X droplet. End-users shouldn't be able to redirect requests
|
| 79 |
+
# to arbitrary hosts.
|
| 80 |
+
backend_url = os.environ.get("GOBLIN_AUTO_TUNE_URL", "").strip()
|
| 81 |
backend_mode = st.radio(
|
| 82 |
"Backend",
|
| 83 |
options=("Local subprocess", "Remote GPU server"),
|
| 84 |
+
index=1 if backend_url else 0,
|
| 85 |
help=(
|
| 86 |
+
"Local: launches scripts/auto_tune.py on this host (needs an MI300X). "
|
| 87 |
+
"Remote: POSTs to /auto-tune on the FastAPI server configured via "
|
| 88 |
+
"the GOBLIN_AUTO_TUNE_URL env var."
|
| 89 |
),
|
| 90 |
)
|
|
|
|
| 91 |
if backend_mode == "Remote GPU server":
|
| 92 |
+
if backend_url:
|
| 93 |
+
st.caption(
|
| 94 |
+
f"📡 Backend: `{backend_url}` "
|
| 95 |
+
"(set via `GOBLIN_AUTO_TUNE_URL`)"
|
| 96 |
+
)
|
| 97 |
+
else:
|
| 98 |
+
st.error(
|
| 99 |
+
"Remote mode requires the `GOBLIN_AUTO_TUNE_URL` "
|
| 100 |
+
"environment variable to be set on this host (e.g. via "
|
| 101 |
+
"the HF Space's Settings → Variables and secrets)."
|
| 102 |
+
)
|
| 103 |
|
| 104 |
st.divider()
|
| 105 |
workload_source = st.radio(
|