rafaa commited on
Commit
fa891d6
·
verified ·
1 Parent(s): ccf5c89

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -6
app.py CHANGED
@@ -137,10 +137,7 @@ def generate(
137
  return output
138
 
139
  # Check if the checkbox is selected and the correct password is provided
140
- if enable_tts and passwordInput == ttsPassword:
141
- generate_voice(output, voice_id)
142
- elif enable_tts and passwordInput != ttsPassword:
143
- gr.Warning("Incorrect Password!")
144
 
145
  checkbox = gr.Checkbox(label="Enable TTS")
146
  passwordInput = gr.Textbox(label="TTS Password", type="password")
@@ -155,8 +152,20 @@ with gr.ChatInterface(
155
  additional_inputs=[checkbox, passwordInput],
156
  ) as iface:
157
 
158
- audio_output = gr.Audio(autoplay=True, interactive=False, visible=checkbox)
159
-
 
 
 
 
 
 
160
 
 
 
 
 
 
 
161
 
162
  iface.launch(show_api=False)
 
137
  return output
138
 
139
  # Check if the checkbox is selected and the correct password is provided
140
+
 
 
 
141
 
142
  checkbox = gr.Checkbox(label="Enable TTS")
143
  passwordInput = gr.Textbox(label="TTS Password", type="password")
 
152
  additional_inputs=[checkbox, passwordInput],
153
  ) as iface:
154
 
155
+ out_audio = gr.Audio(
156
+ label="Speech Output",
157
+ type="numpy",
158
+ elem_id="out_audio",
159
+ format="mp3",
160
+ interactive=False,
161
+ autoplay=True
162
+ )
163
 
164
+ if enable_tts and passwordInput == ttsPassword:
165
+ generate_voice(output, voice_id)
166
+ elif enable_tts and passwordInput != ttsPassword:
167
+ gr.Warning("Incorrect Password!")
168
+
169
+ out_audio = generate_voice()
170
 
171
  iface.launch(show_api=False)