Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -868,13 +868,18 @@ if st.session_state["generated_questions"]:
|
|
| 868 |
remaining = 15 - int(now - st.session_state.get("timer_start", 0))
|
| 869 |
if remaining > 0:
|
| 870 |
st.markdown(f"<h4 class='timer-text'>🎙️ {remaining} seconds to answer...</h4>", unsafe_allow_html=True)
|
| 871 |
-
|
| 872 |
-
|
| 873 |
-
|
| 874 |
-
|
| 875 |
-
|
| 876 |
-
|
| 877 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 878 |
|
| 879 |
if webrtc_ctx.state.playing:
|
| 880 |
if st.button("⏹️ Stop Recording"):
|
|
|
|
| 868 |
remaining = 15 - int(now - st.session_state.get("timer_start", 0))
|
| 869 |
if remaining > 0:
|
| 870 |
st.markdown(f"<h4 class='timer-text'>🎙️ {remaining} seconds to answer...</h4>", unsafe_allow_html=True)
|
| 871 |
+
|
| 872 |
+
audio_bytes = st.audio_input("🎙️ Record your answer (tap when done)", key=f"audio_{idx}")
|
| 873 |
+
|
| 874 |
+
if audio_bytes:
|
| 875 |
+
wav_path = f"response_{idx}.wav"
|
| 876 |
+
with open(wav_path, "wb") as f:
|
| 877 |
+
f.write(audio_bytes.getbuffer())
|
| 878 |
+
st.audio(wav_path)
|
| 879 |
+
st.session_state["answers"].append({
|
| 880 |
+
"question": question,
|
| 881 |
+
"response_file": wav_path
|
| 882 |
+
})
|
| 883 |
|
| 884 |
if webrtc_ctx.state.playing:
|
| 885 |
if st.button("⏹️ Stop Recording"):
|