SohomToom commited on
Commit
3e61782
·
verified ·
1 Parent(s): 3db8382

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -2
app.py CHANGED
@@ -60,11 +60,26 @@ def docx_to_wav(doc_file, selected_voice, selected_speaker=None):
60
 
61
  def show_load_button(voice_selection):
62
  info = VOICE_MODELS[voice_selection]
63
- return gr.update(visible=info["multi_speaker"]), gr.update(visible=False), gr.update(visible=False, interactive=False)
 
 
 
 
 
 
 
 
 
 
 
64
 
65
  def load_and_show_speakers(voice_selection):
66
  speakers = extract_speakers(voice_selection)
67
- return gr.update(choices=speakers, visible=True, value=speakers[0]), gr.update(interactive=True)
 
 
 
 
68
 
69
  with gr.Blocks() as interface:
70
  gr.Markdown("# 🎤 Realistic Voiceover from DOCX\nUpload a `.docx` file, select a voice, and generate lifelike speech!")
 
60
 
61
  def show_load_button(voice_selection):
62
  info = VOICE_MODELS[voice_selection]
63
+ if info["multi_speaker"]:
64
+ return (
65
+ gr.update(visible=True), # Show "Load Speakers"
66
+ gr.update(visible=False), # Hide speaker dropdown until loaded
67
+ gr.update(interactive=False) # Disable generate button
68
+ )
69
+ else:
70
+ return (
71
+ gr.update(visible=False), # Hide "Load Speakers"
72
+ gr.update(visible=False), # Hide speaker dropdown
73
+ gr.update(interactive=True) # Enable generate button for single speaker
74
+ )
75
 
76
  def load_and_show_speakers(voice_selection):
77
  speakers = extract_speakers(voice_selection)
78
+ return (
79
+ gr.update(choices=speakers, visible=True, value=speakers[0]),
80
+ gr.update(interactive=True) # Now enable the generate button
81
+ )
82
+
83
 
84
  with gr.Blocks() as interface:
85
  gr.Markdown("# 🎤 Realistic Voiceover from DOCX\nUpload a `.docx` file, select a voice, and generate lifelike speech!")