Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -443,8 +443,6 @@ def tts_response(history, response, tts_choice):
|
|
443 |
audio_future = executor.submit(generate_audio_elevenlabs, response)
|
444 |
elif tts_choice == "Beta":
|
445 |
audio_future = executor.submit(generate_audio_parler_tts, response)
|
446 |
-
# elif tts_choice == "Gamma":
|
447 |
-
# audio_future = executor.submit(generate_audio_mars5, response)
|
448 |
|
449 |
# Initialize the response string if it's None
|
450 |
if history[-1][1] is None:
|
@@ -459,8 +457,12 @@ def tts_response(history, response, tts_choice):
|
|
459 |
# Get the path of the generated audio
|
460 |
audio_path = audio_future.result()
|
461 |
|
462 |
-
#
|
463 |
-
|
|
|
|
|
|
|
|
|
464 |
|
465 |
|
466 |
|
@@ -710,10 +712,16 @@ def generate_answer(message, choice, retrieval_mode, selected_model):
|
|
710 |
|
711 |
|
712 |
|
|
|
|
|
|
|
|
|
713 |
def add_message(history, message):
|
714 |
-
|
|
|
715 |
return history, gr.Textbox(value="", interactive=True, show_label=False)
|
716 |
|
|
|
717 |
def print_like_dislike(x: gr.LikeData):
|
718 |
print(x.index, x.value, x.liked)
|
719 |
|
|
|
443 |
audio_future = executor.submit(generate_audio_elevenlabs, response)
|
444 |
elif tts_choice == "Beta":
|
445 |
audio_future = executor.submit(generate_audio_parler_tts, response)
|
|
|
|
|
446 |
|
447 |
# Initialize the response string if it's None
|
448 |
if history[-1][1] is None:
|
|
|
457 |
# Get the path of the generated audio
|
458 |
audio_path = audio_future.result()
|
459 |
|
460 |
+
# Check if the audio path is valid before yielding it
|
461 |
+
if audio_path and os.path.exists(audio_path):
|
462 |
+
yield history, audio_path
|
463 |
+
else:
|
464 |
+
logging.error("Audio file not generated correctly")
|
465 |
+
yield history, None
|
466 |
|
467 |
|
468 |
|
|
|
712 |
|
713 |
|
714 |
|
715 |
+
# def add_message(history, message):
|
716 |
+
# history.append((message, None))
|
717 |
+
# return history, gr.Textbox(value="", interactive=True, show_label=False)
|
718 |
+
|
719 |
def add_message(history, message):
|
720 |
+
# Append a tuple with the user's message and a placeholder for the assistant's response
|
721 |
+
history.append((message, "")) # Use an empty string to ensure the format is correct
|
722 |
return history, gr.Textbox(value="", interactive=True, show_label=False)
|
723 |
|
724 |
+
|
725 |
def print_like_dislike(x: gr.LikeData):
|
726 |
print(x.index, x.value, x.liked)
|
727 |
|