Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -377,7 +377,7 @@ def bot(history, choice, tts_choice, retrieval_mode, model_choice):
|
|
377 |
selected_model = chat_model if model_choice == "GPT-4o" else phi_pipe
|
378 |
|
379 |
response, addresses = generate_answer(history[-1][0], choice, retrieval_mode, selected_model)
|
380 |
-
history[-1][1] =
|
381 |
|
382 |
with concurrent.futures.ThreadPoolExecutor() as executor:
|
383 |
if tts_choice == "Alpha":
|
@@ -385,16 +385,16 @@ def bot(history, choice, tts_choice, retrieval_mode, model_choice):
|
|
385 |
elif tts_choice == "Beta":
|
386 |
audio_stream = generate_audio_parler_tts(response)
|
387 |
|
388 |
-
# Stream audio chunks in real-time
|
389 |
for audio_chunk_path in audio_stream:
|
390 |
-
|
391 |
-
yield history, audio_chunk_path
|
392 |
|
393 |
history.append([response, None])
|
394 |
|
395 |
|
396 |
|
397 |
|
|
|
398 |
phi_custom_template = """
|
399 |
<|system|>
|
400 |
You are a helpful assistant who provides clear, organized, crisp and conversational responses about an events,concerts,sports and all other activities of Birmingham,Alabama .<|end|>
|
|
|
377 |
selected_model = chat_model if model_choice == "GPT-4o" else phi_pipe
|
378 |
|
379 |
response, addresses = generate_answer(history[-1][0], choice, retrieval_mode, selected_model)
|
380 |
+
history[-1][1] = response # Set the full response in the history immediately
|
381 |
|
382 |
with concurrent.futures.ThreadPoolExecutor() as executor:
|
383 |
if tts_choice == "Alpha":
|
|
|
385 |
elif tts_choice == "Beta":
|
386 |
audio_stream = generate_audio_parler_tts(response)
|
387 |
|
388 |
+
# Stream audio chunks in real-time without interrupting text output
|
389 |
for audio_chunk_path in audio_stream:
|
390 |
+
yield history, audio_chunk_path # Yield audio chunks as they are generated
|
|
|
391 |
|
392 |
history.append([response, None])
|
393 |
|
394 |
|
395 |
|
396 |
|
397 |
+
|
398 |
phi_custom_template = """
|
399 |
<|system|>
|
400 |
You are a helpful assistant who provides clear, organized, crisp and conversational responses about an events,concerts,sports and all other activities of Birmingham,Alabama .<|end|>
|