Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -122,12 +122,21 @@ def generate(
|
|
122 |
# Play the audio file
|
123 |
elevenlabs.play(audio)
|
124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
mychatbot = gr.Chatbot(
|
126 |
avatar_images=["./user.png", "./stella.jpg"], bubble_full_width=False, show_label=False, show_copy_button=True, likeable=True)
|
127 |
|
128 |
checkbox = gr.Checkbox(label="Enable TTS") # remove the fn parameter
|
129 |
passwordInput = gr.Textbox(label="TTS Password", type="password")
|
130 |
|
|
|
|
|
|
|
131 |
# Create a Gradio interface with the TTS checkbox and password input
|
132 |
mychatbot = gr.Chatbot(
|
133 |
avatar_images=["./user.png", "./stella.jpg"], bubble_full_width=False, show_label=False, show_copy_button=True, likeable=True)
|
@@ -138,7 +147,8 @@ demo = gr.ChatInterface(
|
|
138 |
title="Stella 🌸",
|
139 |
retry_btn=None,
|
140 |
undo_btn=None,
|
141 |
-
additional_inputs=[checkbox, passwordInput]
|
|
|
142 |
)
|
143 |
|
144 |
|
|
|
122 |
# Play the audio file
|
123 |
elevenlabs.play(audio)
|
124 |
|
125 |
+
# Return the audio file as a numpy array
|
126 |
+
return audio
|
127 |
+
else:
|
128 |
+
# Return None if the TTS is not enabled or the password is incorrect
|
129 |
+
return None
|
130 |
+
|
131 |
mychatbot = gr.Chatbot(
|
132 |
avatar_images=["./user.png", "./stella.jpg"], bubble_full_width=False, show_label=False, show_copy_button=True, likeable=True)
|
133 |
|
134 |
checkbox = gr.Checkbox(label="Enable TTS") # remove the fn parameter
|
135 |
passwordInput = gr.Textbox(label="TTS Password", type="password")
|
136 |
|
137 |
+
# Define the output component
|
138 |
+
audio_output = gr.Audio(label="Audio") # Add the audio component as an output
|
139 |
+
|
140 |
# Create a Gradio interface with the TTS checkbox and password input
|
141 |
mychatbot = gr.Chatbot(
|
142 |
avatar_images=["./user.png", "./stella.jpg"], bubble_full_width=False, show_label=False, show_copy_button=True, likeable=True)
|
|
|
147 |
title="Stella 🌸",
|
148 |
retry_btn=None,
|
149 |
undo_btn=None,
|
150 |
+
additional_inputs=[checkbox, passwordInput],
|
151 |
+
outputs=audio_output # Add the output
|
152 |
)
|
153 |
|
154 |
|