Pabloler21 Claude Fable 5 commited on
Commit
fb01849
·
1 Parent(s): 3faab14

fix: keep voice_panel mounted (CSS-collapsed) so the audio actually plays

Browse files

visible=False can unmount the component in Gradio so the <audio> never reaches
the DOM and never plays. Mount it and collapse to zero size via CSS instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Files changed (2) hide show
  1. app.py +4 -1
  2. styles.css +11 -0
app.py CHANGED
@@ -530,7 +530,10 @@ with gr.Blocks(title="Hollow") as demo:
530
 
531
  with gr.Column(scale=1):
532
  treasure_panel = gr.HTML(value=render_treasure([]))
533
- voice_panel = gr.HTML(visible=False) # carries Hollow's voice <audio>
 
 
 
534
 
535
  # show_progress="hidden" kills Gradio's per-component "processing" overlay;
536
  # we show our own "..." pending bubble instead (set in _start_turn)
 
530
 
531
  with gr.Column(scale=1):
532
  treasure_panel = gr.HTML(value=render_treasure([]))
533
+ # carries Hollow's voice <audio>; kept MOUNTED (not visible=False,
534
+ # which can unmount it so the audio never plays) and collapsed to
535
+ # zero size via CSS so it has no visual footprint
536
+ voice_panel = gr.HTML(elem_classes="voice-channel")
537
 
538
  # show_progress="hidden" kills Gradio's per-component "processing" overlay;
539
  # we show our own "..." pending bubble instead (set in _start_turn)
styles.css CHANGED
@@ -845,3 +845,14 @@ footer { display: none !important; }
845
  color: #c8b0e0 !important;
846
  background: rgba(40, 26, 56, 0.8) !important;
847
  }
 
 
 
 
 
 
 
 
 
 
 
 
845
  color: #c8b0e0 !important;
846
  background: rgba(40, 26, 56, 0.8) !important;
847
  }
848
+
849
+ /* the voice channel: mounted in the DOM (so the <audio> plays) but collapsed
850
+ to nothing — audio keeps playing in a zero-size element, no visual footprint */
851
+ .voice-channel {
852
+ height: 0 !important;
853
+ min-height: 0 !important;
854
+ padding: 0 !important;
855
+ margin: 0 !important;
856
+ border: none !important;
857
+ overflow: hidden !important;
858
+ }