Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -870,37 +870,37 @@ if st.session_state["generated_questions"]:
|
|
| 870 |
st.markdown(f"<h4 class='timer-text'>🎙️ {remaining} seconds to answer...</h4>", unsafe_allow_html=True)
|
| 871 |
|
| 872 |
audio_value = st.audio_input("🎤 Tap to record — then stop when done", key=f"audio_{idx}")
|
| 873 |
-
|
| 874 |
-
|
| 875 |
-
|
| 876 |
-
|
| 877 |
-
|
| 878 |
-
|
| 879 |
-
|
| 880 |
-
|
| 881 |
-
|
| 882 |
-
|
| 883 |
-
|
| 884 |
|
| 885 |
|
| 886 |
-
|
| 887 |
-
|
| 888 |
-
|
| 889 |
-
|
| 890 |
-
|
| 891 |
-
|
| 892 |
|
| 893 |
-
|
| 894 |
-
|
| 895 |
-
|
| 896 |
-
|
| 897 |
})
|
| 898 |
|
| 899 |
-
|
| 900 |
-
|
| 901 |
-
|
| 902 |
|
| 903 |
-
|
| 904 |
|
| 905 |
else:
|
| 906 |
st.markdown("<div style='padding:10px; background:#fff3e0; border-left:5px solid orange;'>⚠️ <strong>No response detected.</strong> Moving to next question...</div>", unsafe_allow_html=True)
|
|
|
|
| 870 |
st.markdown(f"<h4 class='timer-text'>🎙️ {remaining} seconds to answer...</h4>", unsafe_allow_html=True)
|
| 871 |
|
| 872 |
audio_value = st.audio_input("🎤 Tap to record — then stop when done", key=f"audio_{idx}")
|
| 873 |
+
if audio_value:
|
| 874 |
+
wav_path = f"response_{idx}.wav"
|
| 875 |
+
with open(wav_path, "wb") as f:
|
| 876 |
+
f.write(audio_value.getbuffer())
|
| 877 |
+
st.audio(wav_path, format="audio/wav")
|
| 878 |
+
|
| 879 |
+
st.session_state.update({
|
| 880 |
+
"record_phase": "listening",
|
| 881 |
+
"response_file": wav_path,
|
| 882 |
+
})
|
| 883 |
+
st.experimental_rerun()
|
| 884 |
|
| 885 |
|
| 886 |
+
else:
|
| 887 |
+
st.warning("⚠️ No audio captured.")
|
| 888 |
+
st.session_state["answers"].append({
|
| 889 |
+
"question": question,
|
| 890 |
+
"response": "[No response]"
|
| 891 |
+
})
|
| 892 |
|
| 893 |
+
st.session_state.update({
|
| 894 |
+
"record_phase": "idle",
|
| 895 |
+
"question_played": False,
|
| 896 |
+
"current_question_index": idx + 1
|
| 897 |
})
|
| 898 |
|
| 899 |
+
if st.session_state["current_question_index"] == len(st.session_state["generated_questions"]):
|
| 900 |
+
evaluate_answers()
|
| 901 |
+
st.session_state["show_summary"] = True
|
| 902 |
|
| 903 |
+
st.experimental_rerun()
|
| 904 |
|
| 905 |
else:
|
| 906 |
st.markdown("<div style='padding:10px; background:#fff3e0; border-left:5px solid orange;'>⚠️ <strong>No response detected.</strong> Moving to next question...</div>", unsafe_allow_html=True)
|