Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -19,7 +19,6 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
19 |
# Try to import spaces; if available, wrap functions for GPU support.
|
20 |
try:
|
21 |
import spaces
|
22 |
-
|
23 |
USING_SPACES = True
|
24 |
except ImportError:
|
25 |
USING_SPACES = False
|
@@ -206,7 +205,8 @@ Have a conversation with an AI using your reference voice!
|
|
206 |
lines=2,
|
207 |
)
|
208 |
|
209 |
-
|
|
|
210 |
|
211 |
with gr.Row():
|
212 |
with gr.Column():
|
@@ -231,6 +231,9 @@ Have a conversation with an AI using your reference voice!
|
|
231 |
]
|
232 |
)
|
233 |
|
|
|
|
|
|
|
234 |
@gpu_decorator
|
235 |
def generate_audio_response(history, ref_audio, ref_text, remove_silence):
|
236 |
"""
|
@@ -280,7 +283,7 @@ Have a conversation with an AI using your reference voice!
|
|
280 |
audio_input_chat.stop_recording(
|
281 |
process_audio_input,
|
282 |
inputs=[audio_input_chat, text_input_chat, groq_apikey, chatbot_interface, conversation_state],
|
283 |
-
outputs=[chatbot_interface, conversation_state,
|
284 |
).then(
|
285 |
generate_audio_response,
|
286 |
inputs=[chatbot_interface, ref_audio_chat, ref_text_chat, remove_silence_chat],
|
@@ -290,7 +293,7 @@ Have a conversation with an AI using your reference voice!
|
|
290 |
text_input_chat.submit(
|
291 |
process_audio_input,
|
292 |
inputs=[audio_input_chat, text_input_chat, groq_apikey, chatbot_interface, conversation_state],
|
293 |
-
outputs=[chatbot_interface, conversation_state,
|
294 |
).then(
|
295 |
generate_audio_response,
|
296 |
inputs=[chatbot_interface, ref_audio_chat, ref_text_chat, remove_silence_chat],
|
@@ -300,7 +303,7 @@ Have a conversation with an AI using your reference voice!
|
|
300 |
send_btn_chat.click(
|
301 |
process_audio_input,
|
302 |
inputs=[audio_input_chat, text_input_chat, groq_apikey, chatbot_interface, conversation_state],
|
303 |
-
outputs=[chatbot_interface, conversation_state,
|
304 |
).then(
|
305 |
generate_audio_response,
|
306 |
inputs=[chatbot_interface, ref_audio_chat, ref_text_chat, remove_silence_chat],
|
|
|
19 |
# Try to import spaces; if available, wrap functions for GPU support.
|
20 |
try:
|
21 |
import spaces
|
|
|
22 |
USING_SPACES = True
|
23 |
except ImportError:
|
24 |
USING_SPACES = False
|
|
|
205 |
lines=2,
|
206 |
)
|
207 |
|
208 |
+
# Specify the chatbot type to avoid deprecation warnings.
|
209 |
+
chatbot_interface = gr.Chatbot(label="Conversation", type="messages")
|
210 |
|
211 |
with gr.Row():
|
212 |
with gr.Column():
|
|
|
231 |
]
|
232 |
)
|
233 |
|
234 |
+
# Create a dummy hidden output to capture the extra (unused) output.
|
235 |
+
dummy_output = gr.Textbox(visible=False)
|
236 |
+
|
237 |
@gpu_decorator
|
238 |
def generate_audio_response(history, ref_audio, ref_text, remove_silence):
|
239 |
"""
|
|
|
283 |
audio_input_chat.stop_recording(
|
284 |
process_audio_input,
|
285 |
inputs=[audio_input_chat, text_input_chat, groq_apikey, chatbot_interface, conversation_state],
|
286 |
+
outputs=[chatbot_interface, conversation_state, dummy_output],
|
287 |
).then(
|
288 |
generate_audio_response,
|
289 |
inputs=[chatbot_interface, ref_audio_chat, ref_text_chat, remove_silence_chat],
|
|
|
293 |
text_input_chat.submit(
|
294 |
process_audio_input,
|
295 |
inputs=[audio_input_chat, text_input_chat, groq_apikey, chatbot_interface, conversation_state],
|
296 |
+
outputs=[chatbot_interface, conversation_state, dummy_output],
|
297 |
).then(
|
298 |
generate_audio_response,
|
299 |
inputs=[chatbot_interface, ref_audio_chat, ref_text_chat, remove_silence_chat],
|
|
|
303 |
send_btn_chat.click(
|
304 |
process_audio_input,
|
305 |
inputs=[audio_input_chat, text_input_chat, groq_apikey, chatbot_interface, conversation_state],
|
306 |
+
outputs=[chatbot_interface, conversation_state, dummy_output],
|
307 |
).then(
|
308 |
generate_audio_response,
|
309 |
inputs=[chatbot_interface, ref_audio_chat, ref_text_chat, remove_silence_chat],
|