Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,6 +17,7 @@ import traceback
|
|
| 17 |
from streamlit_webrtc import webrtc_streamer, WebRtcMode
|
| 18 |
from twilio.rest import Client
|
| 19 |
import logging
|
|
|
|
| 20 |
|
| 21 |
|
| 22 |
# ✅ MUST be the first Streamlit command
|
|
@@ -869,12 +870,13 @@ if st.session_state["generated_questions"]:
|
|
| 869 |
if remaining > 0:
|
| 870 |
st.markdown(f"<h4 class='timer-text'>🎙️ {remaining} seconds to answer...</h4>", unsafe_allow_html=True)
|
| 871 |
|
| 872 |
-
|
| 873 |
-
if
|
| 874 |
wav_path = f"response_{idx}.wav"
|
| 875 |
with open(wav_path, "wb") as f:
|
| 876 |
-
f.write(
|
| 877 |
st.audio(wav_path, format="audio/wav")
|
|
|
|
| 878 |
|
| 879 |
st.session_state.update({
|
| 880 |
"record_phase": "listening",
|
|
|
|
| 17 |
from streamlit_webrtc import webrtc_streamer, WebRtcMode
|
| 18 |
from twilio.rest import Client
|
| 19 |
import logging
|
| 20 |
+
from audiorecorder import audiorecorder
|
| 21 |
|
| 22 |
|
| 23 |
# ✅ MUST be the first Streamlit command
|
|
|
|
| 870 |
if remaining > 0:
|
| 871 |
st.markdown(f"<h4 class='timer-text'>🎙️ {remaining} seconds to answer...</h4>", unsafe_allow_html=True)
|
| 872 |
|
| 873 |
+
audio_bytes = audiorecorder("Click to start recording", "Click to stop")
|
| 874 |
+
if audio_bytes:
|
| 875 |
wav_path = f"response_{idx}.wav"
|
| 876 |
with open(wav_path, "wb") as f:
|
| 877 |
+
f.write(audio_bytes)
|
| 878 |
st.audio(wav_path, format="audio/wav")
|
| 879 |
+
|
| 880 |
|
| 881 |
st.session_state.update({
|
| 882 |
"record_phase": "listening",
|