mehdilaalali commited on
Commit
405e984
·
verified ·
1 Parent(s): ceefeb6

fix: remove demo.load to prevent Gradio 6 tab component race condition freezing UI

Browse files
Files changed (1) hide show
  1. app.py +3 -9
app.py CHANGED
@@ -369,11 +369,7 @@ label span {
369
  footer { display: none !important; }
370
  """
371
 
372
- # Helper to initialize voices on ui load
373
- def init_voices_ui():
374
- choices = get_voice_choices()
375
- default_val = choices[0][1] if choices else None
376
- return gr.update(choices=choices, value=default_val)
377
 
378
  with gr.Blocks(title="Voxtral Studio — Mistral AI Audio", css=css) as demo:
379
 
@@ -438,7 +434,8 @@ with gr.Blocks(title="Voxtral Studio — Mistral AI Audio", css=css) as demo:
438
  with gr.Row():
439
  tts_voice_id = gr.Dropdown(
440
  label="Select a Mistral Voice or Your Clones",
441
- choices=[], # Populated on load
 
442
  allow_custom_value=True,
443
  scale=3,
444
  )
@@ -533,8 +530,5 @@ with gr.Blocks(title="Voxtral Studio — Mistral AI Audio", css=css) as demo:
533
  """)
534
 
535
 
536
- # Populate choices dynamically when the page loads for each user!
537
- demo.load(fn=init_voices_ui, outputs=tts_voice_id)
538
-
539
  if __name__ == "__main__":
540
  demo.launch(server_name="0.0.0.0", server_port=7860)
 
369
  footer { display: none !important; }
370
  """
371
 
372
+ INITIAL_VOICES = get_voice_choices()
 
 
 
 
373
 
374
  with gr.Blocks(title="Voxtral Studio — Mistral AI Audio", css=css) as demo:
375
 
 
434
  with gr.Row():
435
  tts_voice_id = gr.Dropdown(
436
  label="Select a Mistral Voice or Your Clones",
437
+ choices=INITIAL_VOICES,
438
+ value=INITIAL_VOICES[0][1] if INITIAL_VOICES else None,
439
  allow_custom_value=True,
440
  scale=3,
441
  )
 
530
  """)
531
 
532
 
 
 
 
533
  if __name__ == "__main__":
534
  demo.launch(server_name="0.0.0.0", server_port=7860)