From 7569cdc3225e7ef60a6110cec63e4d5d0c15413d Mon Sep 17 00:00:00 2001 From: Steve Calcott Date: Wed, 16 Sep 2026 10:39:12 +0000 Subject: [PATCH] Fix Characters tab: every selection errored, dropdown went stale Real bug, not user error: Gradio refuses to serve a file back to the browser unless it lives under the app's own directory, the system temp dir, or an explicit allowlist. Every character's reference audio lives in the-service-station repo, a completely different path, so selecting *any* character in the Characters tab threw gradio.exceptions.InvalidPathError server-side (visible in the server log, not surfaced usefully in the browser's generic error toast). Fixed with launch(allowed_paths=[SERVICE_STATION_DIR]), the documented fix for this exact error. Also: the character dropdowns choices were fixed at server-start time, so a character created earlier in the same running session did not show up without manually clicking Refresh. Added a demo.load() hook to refresh both dropdowns automatically on page load, in addition to keeping the manual Refresh button for mid-session use without a full reload. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01Y1oQ4h4WE4R9KRvMQLr5Ey --- webui/app.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/webui/app.py b/webui/app.py index c98403a..9954e80 100644 --- a/webui/app.py +++ b/webui/app.py @@ -798,6 +798,22 @@ with gr.Blocks(title="Audio-demo pipeline studio") as demo: inputs=[emotion_char_dd, emotion_word_tb, emotion_model_dd], outputs=[emotion_ref_audio, emotion_preview_audio, emotion_status], ) + # Dropdown choices are otherwise fixed at server-start time, so a + # character created earlier in the same running session (or by + # someone else) wouldn't show up without this - refresh + # automatically on every page load, in addition to the manual + # Refresh button above for mid-session use without reloading. + demo.load( + lambda: (gr.update(choices=character_names()), gr.update(choices=character_names())), + outputs=[char_dd, emotion_char_dd], + ) if __name__ == "__main__": - demo.launch(server_name="0.0.0.0", server_port=7860) + # Gradio refuses to serve a file back to the browser unless it's under + # the app's own directory, the system temp dir, or explicitly allowed - + # every character's reference audio lives in the-service-station repo, + # a different path entirely, so every single Characters-tab selection + # errored without this (found via a real user report + the server log, + # not by inspection - the error only surfaces server-side, not in the + # browser's generic error toast). + demo.launch(server_name="0.0.0.0", server_port=7860, allowed_paths=[str(SERVICE_STATION_DIR)])