Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -56,11 +56,11 @@ def main(answer_mode: str):
|
|
56 |
final_response = base_model_chatbot(st.session_state.messages)
|
57 |
elif answer_mode == 'pdf_chat':
|
58 |
final_response = with_pdf_chatbot(st.session_state.messages)
|
59 |
-
|
60 |
-
#
|
61 |
-
if final_response[-1]
|
62 |
-
final_response += "
|
63 |
-
|
64 |
with st.spinner("Generating audio response..."):
|
65 |
audio_file = text_to_speech(final_response)
|
66 |
autoplay_audio(audio_file)
|
@@ -68,6 +68,7 @@ def main(answer_mode: str):
|
|
68 |
st.session_state.messages.append({"role": "assistant", "content": final_response})
|
69 |
os.remove(audio_file)
|
70 |
|
|
|
71 |
# Float the footer container and provide CSS to target it with
|
72 |
footer_container.float("bottom: 0rem;")
|
73 |
|
|
|
56 |
final_response = base_model_chatbot(st.session_state.messages)
|
57 |
elif answer_mode == 'pdf_chat':
|
58 |
final_response = with_pdf_chatbot(st.session_state.messages)
|
59 |
+
|
60 |
+
# Add final check for punctuation and completeness
|
61 |
+
if not final_response.strip()[-1] in ".!?":
|
62 |
+
final_response += " This is the end of the response. Let me know if you need anything else."
|
63 |
+
|
64 |
with st.spinner("Generating audio response..."):
|
65 |
audio_file = text_to_speech(final_response)
|
66 |
autoplay_audio(audio_file)
|
|
|
68 |
st.session_state.messages.append({"role": "assistant", "content": final_response})
|
69 |
os.remove(audio_file)
|
70 |
|
71 |
+
|
72 |
# Float the footer container and provide CSS to target it with
|
73 |
footer_container.float("bottom: 0rem;")
|
74 |
|