Spaces:
Sleeping
Sleeping
added waiting response for narrator
Browse files- chatbot.py +4 -0
chatbot.py
CHANGED
|
@@ -149,12 +149,16 @@ def render_chatbot(code, output, error):
|
|
| 149 |
# π Speak
|
| 150 |
speak_btn = st.button(f"π Narrate #{i+1}")
|
| 151 |
if speak_btn:
|
|
|
|
| 152 |
bot = CodeAssistantBot()
|
| 153 |
narration = bot.narrate_response(code, output, error, a, st.session_state.chat_summary)
|
|
|
|
| 154 |
audio_filename = f"audio_{uuid.uuid4().hex}.mp3"
|
| 155 |
asyncio.run(text_to_speech(narration, audio_filename))
|
|
|
|
| 156 |
st.audio(audio_filename, format="audio/mp3", autoplay=True)
|
| 157 |
|
|
|
|
| 158 |
if start > 0 and st.button("π½ Show more"):
|
| 159 |
st.session_state.chat_display_count += 5
|
| 160 |
st.rerun()
|
|
|
|
| 149 |
# π Speak
|
| 150 |
speak_btn = st.button(f"π Narrate #{i+1}")
|
| 151 |
if speak_btn:
|
| 152 |
+
status_placeholder.info("π§ Generating narration...")
|
| 153 |
bot = CodeAssistantBot()
|
| 154 |
narration = bot.narrate_response(code, output, error, a, st.session_state.chat_summary)
|
| 155 |
+
status_placeholder.info("ποΈ Converting to audio...")
|
| 156 |
audio_filename = f"audio_{uuid.uuid4().hex}.mp3"
|
| 157 |
asyncio.run(text_to_speech(narration, audio_filename))
|
| 158 |
+
status_placeholder.success("π Narration ready!")
|
| 159 |
st.audio(audio_filename, format="audio/mp3", autoplay=True)
|
| 160 |
|
| 161 |
+
|
| 162 |
if start > 0 and st.button("π½ Show more"):
|
| 163 |
st.session_state.chat_display_count += 5
|
| 164 |
st.rerun()
|