Update app.py
Browse files
app.py
CHANGED
|
@@ -190,33 +190,31 @@ if submitted or st.session_state.dictee != None:
|
|
| 190 |
with st.spinner("🎵 Assemblage de l'audio complet..."):
|
| 191 |
st.session_state.concatenated_audio_path = concatenate_audio(audio_urls)
|
| 192 |
concatenated_audio_path = st.session_state.concatenated_audio_path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 193 |
|
| 194 |
-
|
| 195 |
-
with
|
| 196 |
-
st.
|
| 197 |
-
st.
|
| 198 |
-
st.divider()
|
| 199 |
-
st.sidebar.markdown("## 📖 Phrases de la Dictée")
|
| 200 |
-
cols_per_row = 2
|
| 201 |
-
rows = (len(audio_urls) + cols_per_row - 1) // cols_per_row # Arrondir au nombre supérieur
|
| 202 |
-
for i in range(rows):
|
| 203 |
-
cols = st.columns(cols_per_row)
|
| 204 |
-
for j in range(cols_per_row):
|
| 205 |
-
idx = i * cols_per_row + j
|
| 206 |
-
if idx < len(audio_urls):
|
| 207 |
-
with cols[j]:
|
| 208 |
-
st.sidebar.markdown(f"**Phrase {idx + 1}:**")
|
| 209 |
-
st.sidebar.audio(audio_urls[idx], format='audio/wav')
|
| 210 |
-
|
| 211 |
-
with col2:
|
| 212 |
-
st.markdown("## ✍️ Votre Dictée")
|
| 213 |
-
with st.form("dictee_form"):
|
| 214 |
-
dictee_user = st.text_area("Écrivez la dictée ici:", key="dictee_user", height=350)
|
| 215 |
-
correct = st.form_submit_button("📝 Correction")
|
| 216 |
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
|
| 221 |
if st.session_state.correction != None:
|
| 222 |
st.divider()
|
|
|
|
| 190 |
with st.spinner("🎵 Assemblage de l'audio complet..."):
|
| 191 |
st.session_state.concatenated_audio_path = concatenate_audio(audio_urls)
|
| 192 |
concatenated_audio_path = st.session_state.concatenated_audio_path
|
| 193 |
+
|
| 194 |
+
st.sidebar.markdown("## 📖 Dictée en entier")
|
| 195 |
+
st.sidebar.audio(concatenated_audio_path, format='audio/wav', start_time=0)
|
| 196 |
+
st.divider()
|
| 197 |
+
st.sidebar.markdown("## 📖 Phrases de la Dictée")
|
| 198 |
+
st.sidebar.caption("Le bouton sert a cocher les phrases que vous avez fait.")
|
| 199 |
+
cols_per_row = 2
|
| 200 |
+
rows = (len(audio_urls) + cols_per_row - 1) // cols_per_row # Arrondir au nombre supérieur
|
| 201 |
+
for i in range(rows):
|
| 202 |
+
cols = st.columns(cols_per_row)
|
| 203 |
+
for j in range(cols_per_row):
|
| 204 |
+
idx = i * cols_per_row + j
|
| 205 |
+
if idx < len(audio_urls):
|
| 206 |
+
with cols[j]:
|
| 207 |
+
st.sidebar.toggle(f"**Phrase {idx + 1}:**")
|
| 208 |
+
st.sidebar.audio(audio_urls[idx], format='audio/wav')
|
| 209 |
|
| 210 |
+
st.markdown("## ✍️ Votre Dictée")
|
| 211 |
+
with st.form("dictee_form"):
|
| 212 |
+
dictee_user = st.text_area("Écrivez la dictée ici:", key="dictee_user", height=350)
|
| 213 |
+
correct = st.form_submit_button("📝 Correction")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
|
| 215 |
+
if correct:
|
| 216 |
+
st.session_state.correction = correction_dictee(dictee, dictee_user)
|
| 217 |
+
st.rerun()
|
| 218 |
|
| 219 |
if st.session_state.correction != None:
|
| 220 |
st.divider()
|