rafaa commited on
Commit
26dcd1d
·
verified ·
1 Parent(s): bd73111

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -16
app.py CHANGED
@@ -147,27 +147,27 @@ passwordInput = gr.Textbox(label="TTS Password", type="password")
147
  passwordConfirm = gr.Button(value="Confirm")
148
  mychatbot = gr.Chatbot(avatar_images=["./user.png", "./stella.jpg"], bubble_full_width=False, show_label=False, show_copy_button=True, likeable=True)
149
 
150
- with gr.ChatInterface(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  fn=generate,
152
  chatbot=mychatbot,
153
  title="Stella ",
154
  retry_btn=None,
155
  undo_btn=None,
156
  additional_inputs=[checkbox, passwordInput],
157
- ) as iface:
158
-
159
- out_audio = gr.Audio(
160
- interactive=False,
161
- autoplay=True
162
  )
163
 
164
- enable_tts = checkbox
165
-
166
- def ttsEnable():
167
- if enable_tts == true and passwordInput == ttsPassword:
168
- out_audio = generate_voice(output, voice_id)
169
- elif enable_tts == true and passwordInput != ttsPassword:
170
- gr.Warning("Incorrect Password!")
171
- passwordConfirm.click(fn=ttsEnable)
172
-
173
- iface.launch(show_api=False)
 
147
  passwordConfirm = gr.Button(value="Confirm")
148
  mychatbot = gr.Chatbot(avatar_images=["./user.png", "./stella.jpg"], bubble_full_width=False, show_label=False, show_copy_button=True, likeable=True)
149
 
150
+ with mychatbot.change:
151
+ enable_tts = checkbox
152
+
153
+ def ttsEnable():
154
+ if checkbox == True and passwordInput == ttsPassword:
155
+ enable_tts = True
156
+
157
+ elif checkbox == True and passwordInput != ttsPassword:
158
+ gr.Warning("Incorrect Password!")
159
+
160
+ passwordConfirm.click(fn=ttsEnable)
161
+
162
+ if enable_tts == True:
163
+
164
+ chat = gr.ChatInterface(
165
  fn=generate,
166
  chatbot=mychatbot,
167
  title="Stella ",
168
  retry_btn=None,
169
  undo_btn=None,
170
  additional_inputs=[checkbox, passwordInput],
 
 
 
 
 
171
  )
172
 
173
+ chat.launch(show_api=False)