Update app.py
Browse files
app.py
CHANGED
@@ -111,21 +111,21 @@ def launch_bot():
|
|
111 |
message = {"role": "assistant", "content": response}
|
112 |
st.session_state.messages.append(message)
|
113 |
|
114 |
-
|
115 |
-
if audio_result:
|
116 |
-
|
117 |
# st.session_state.messages.append({"role": "user", "content": "Convert to Audio π"})
|
118 |
# with st.chat_message("user"):
|
119 |
# st.write("Convert to Audio π")
|
120 |
#with st.popover("Open Audio"):
|
121 |
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
|
126 |
-
|
127 |
|
128 |
-
|
129 |
|
130 |
|
131 |
|
|
|
111 |
message = {"role": "assistant", "content": response}
|
112 |
st.session_state.messages.append(message)
|
113 |
|
114 |
+
# audio_result = st.button("Convert to Audio π")
|
115 |
+
#if audio_result:
|
116 |
+
# print("audio button pressed")
|
117 |
# st.session_state.messages.append({"role": "user", "content": "Convert to Audio π"})
|
118 |
# with st.chat_message("user"):
|
119 |
# st.write("Convert to Audio π")
|
120 |
#with st.popover("Open Audio"):
|
121 |
|
122 |
+
sound_file = BytesIO()
|
123 |
+
tts = gTTS(response, lang='en')
|
124 |
+
tts.write_to_fp(sound_file)
|
125 |
|
126 |
+
st.audio(sound_file)
|
127 |
|
128 |
+
st.session_state.messages.append(st.audio(sound_file))
|
129 |
|
130 |
|
131 |
|