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 <[email protected]> Claude-Session: https://claude.ai/code/session_01Y1oQ4h4WE4R9KRvMQLr5Ey
This commit is contained in:
1 parent
2bc1cbf6d6
commit
7569cdc322
1 file changed
+17
-1
+17
-1
@@ -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)])
|
||||
Reference in new issue
Block a user