Skip to content
CodexfeatureWeb2 files · +189 −112

Add visible inference-engine selection indicator to Gradio app

Session from read-along-ai-agent-traces on Hugging Face by kingkw1 · MIT · condensed by Coders Talk

11msession
1interventions
GOAL

Add a clear visual indicator showing whether the app is using Modal or local inference, then fix related engine-default and first-load prewarm bugs.

  1. Prompt · +0
    The app doesn't show which inference engine (Modal or local) is selected. Add an indicator, fitting the theme.
  2. Agent did · +0m
    Explored app.py's engine-selection state, added a separate 'active engine' status badge/HTML element wired to button clicks, added a regression test, and verified with pytest (29 passed).
  3. Intervention · +4m
    Developer rejected the badge approach and asked for the mode button itself to change color instead.
    Why: I didn't like adding a whole new object to the UI just to show state — the buttons themselves should carry the selected look.
  4. Agent did · +4m
    Removed the badge entirely and reworked the click handlers/CSS so the selected engine button itself gets a distinct color (green for Turbo, orange for Local) while the inactive button fades; updated tests and reran pytest (29 passed).
  5. Prompt · +10m
    Now fix two issues: default back to Off the Grid (local) mode, and fix first-sentence word-help voices always showing fallback 'browser word help ready'.
  6. Fail · +11m
    Found the bug: ensure_current_level_prewarm received the selected engine but didn't pass it into start_word_voice_prewarm, so the first sentence always prewarmed with the Modal default and fell back to browser word help.
  7. Agent did · +11m
    Introduced DEFAULT_INFERENCE_ENGINE = LOCAL_ENGINE as single source of truth, used it for initial radio value and button styling, fixed the prewarm call to forward the selected engine, added tests, and reran pytest.
  8. Outcome · +11m
    Delivered: color-coded engine buttons replace the badge, local mode restored as default, first-load word-help prewarm bug fixed; 30 tests passing.
VERDICT

Next time I'd just ask for the mode buttons themselves to change color from the start, since that's the solution I actually wanted — the badge approach was wasted work. The correction that mattered was rejecting the badge and asking for button-color state instead; the agent's own diagnosis of the prewarm engine-forwarding bug was solid and fixed cleanly on the first try.

I tried this · 0

Discussion · 0

How Builds work