Fix the Input column layout
Browse filesThree things crowded the narrow left column. The model dropdown's Gradio `info`
reserved two lines of hint text above the control; it is now a shorter caption and
no longer sits in the primary input path. The dropdown displayed the full
"Name (openai/gpt-oss-safeguard-20b)" string, which clipped under the caret, so the
choices are (label, value) pairs — the visible label is just the model name while
the value keeps the "Name (id)" form extract_model_id() parses. Both dropdowns
changed so they still mirror each other.
The policy line moved out of the Group: as a grouped child Gradio renders a
Markdown as a full-width grey band that reads like a divider between unrelated
controls rather than a caption on the run.
Verified locally: every model's value still parses to the right id, and the app
builds against gradio 6.30.
- ui/tab_config.py +7 -1
- ui/tab_testing.py +14 -14
|
@@ -16,8 +16,14 @@ def build_config_tab() -> dict:
|
|
| 16 |
with gr.Tab("⚙️ Model Choice & Configuration"):
|
| 17 |
gr.Markdown("### Model Selection")
|
| 18 |
|
|
|
|
|
|
|
| 19 |
model_choices = [f"{m['name']} ({m['id']})" for m in MODELS]
|
| 20 |
-
model_dropdown = gr.Dropdown(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
reasoning_effort = gr.Dropdown(label="Reasoning Effort (GPT-OSS only)", choices=REASONING_EFFORTS, value="Low", visible=True)
|
| 22 |
|
| 23 |
def update_reasoning_visibility(choice):
|
|
|
|
| 16 |
with gr.Tab("⚙️ Model Choice & Configuration"):
|
| 17 |
gr.Markdown("### Model Selection")
|
| 18 |
|
| 19 |
+
# Value keeps the "Name (id)" form that extract_model_id() parses; the label
|
| 20 |
+
# shows only the name, matching the picker on the Testing tab.
|
| 21 |
model_choices = [f"{m['name']} ({m['id']})" for m in MODELS]
|
| 22 |
+
model_dropdown = gr.Dropdown(
|
| 23 |
+
label="Model",
|
| 24 |
+
choices=[(m["name"], f"{m['name']} ({m['id']})") for m in MODELS],
|
| 25 |
+
value=model_choices[0],
|
| 26 |
+
)
|
| 27 |
reasoning_effort = gr.Dropdown(label="Reasoning Effort (GPT-OSS only)", choices=REASONING_EFFORTS, value="Low", visible=True)
|
| 28 |
|
| 29 |
def update_reasoning_visibility(choice):
|
|
@@ -174,21 +174,21 @@ def build_testing_tab() -> dict:
|
|
| 174 |
with gr.Row():
|
| 175 |
with gr.Column(scale=1):
|
| 176 |
gr.Markdown("### Input")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
with gr.Group():
|
| 178 |
-
# Mirrors the dropdown in Model Choice & Configuration. Switching
|
| 179 |
-
# models is the thing people do most during a session, so it lives
|
| 180 |
-
# on the page they are already looking at; reasoning level, prompts
|
| 181 |
-
# and sampling stay on the configuration tab.
|
| 182 |
-
model_quick_select = gr.Dropdown(
|
| 183 |
-
label="Model",
|
| 184 |
-
choices=[f"{m['name']} ({m['id']})" for m in MODELS],
|
| 185 |
-
value=f"{MODELS[0]['name']} ({MODELS[0]['id']})",
|
| 186 |
-
info="Reasoning level, system prompt and sampling live in ⚙️ Model Choice & Configuration.",
|
| 187 |
-
)
|
| 188 |
-
# Which policy this run will use. The policy lives on another tab,
|
| 189 |
-
# so without this it is easy to run content against one you loaded
|
| 190 |
-
# earlier and forgot about.
|
| 191 |
-
active_policy_display = gr.Markdown("**Policy:** ⚠️ none loaded")
|
| 192 |
test_input = gr.Textbox(label="Test Content", placeholder="Enter content to test...", lines=5)
|
| 193 |
example_dropdown = gr.Dropdown(label="Load Example", choices=list(examples.keys()), value=None)
|
| 194 |
load_example_btn = gr.Button("Load Example", variant="secondary")
|
|
|
|
| 174 |
with gr.Row():
|
| 175 |
with gr.Column(scale=1):
|
| 176 |
gr.Markdown("### Input")
|
| 177 |
+
# Mirrors the dropdown in Model Choice & Configuration. The visible
|
| 178 |
+
# label is just the model name — the full "Name (id)" string is kept as
|
| 179 |
+
# the value because extract_model_id() parses the id out of it, but
|
| 180 |
+
# showing it clips in this column. The hint about where the other
|
| 181 |
+
# settings live is a caption rather than Gradio `info`, which reserved
|
| 182 |
+
# two lines above the control.
|
| 183 |
+
model_quick_select = gr.Dropdown(
|
| 184 |
+
label="Model",
|
| 185 |
+
choices=[(m["name"], f"{m['name']} ({m['id']})") for m in MODELS],
|
| 186 |
+
value=f"{MODELS[0]['name']} ({MODELS[0]['id']})",
|
| 187 |
+
)
|
| 188 |
+
# Which policy this run will use. Outside a Group: as a grouped child
|
| 189 |
+
# Gradio renders it as a full-width grey band that reads like a divider.
|
| 190 |
+
active_policy_display = gr.Markdown("**Policy:** ⚠️ none loaded")
|
| 191 |
with gr.Group():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
test_input = gr.Textbox(label="Test Content", placeholder="Enter content to test...", lines=5)
|
| 193 |
example_dropdown = gr.Dropdown(label="Load Example", choices=list(examples.keys()), value=None)
|
| 194 |
load_example_btn = gr.Button("Load Example", variant="secondary")
|