bharathtelu commited on
Commit
8a243be
·
verified ·
1 Parent(s): a9aa4ae

UI: read backend URL from env only, not user input

Browse files
Files changed (1) hide show
  1. 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
- default_backend = os.environ.get("GOBLIN_AUTO_TUNE_URL", "")
 
 
 
 
 
76
  backend_mode = st.radio(
77
  "Backend",
78
  options=("Local subprocess", "Remote GPU server"),
79
- index=1 if default_backend else 0,
80
  help=(
81
- "Local: launches scripts/auto_tune.py here (this host needs an MI300X). "
82
- "Remote: POSTs to /auto-tune on a FastAPI server you've stood up on "
83
- "the GPU host. Use Remote when running the UI on HF Spaces."
84
  ),
85
  )
86
- backend_url = ""
87
  if backend_mode == "Remote GPU server":
88
- backend_url = st.text_input(
89
- "Backend URL",
90
- value=default_backend or "http://localhost:8000",
91
- help="Base URL of the FastAPI server (no trailing slash). "
92
- "/auto-tune is appended automatically.",
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(