Update app.py
Browse files
app.py
CHANGED
@@ -167,6 +167,8 @@ with st.expander("📝 Génération de la dictée", expanded=st.session_state.ex
|
|
167 |
longueur = st.slider("Longueur de la dictée (nombre de mots)", 50, 500, 200)
|
168 |
submitted = st.form_submit_button("🔮 Générer la Dictée", disabled=st.session_state.dicteecreation)
|
169 |
|
|
|
|
|
170 |
if submitted or st.session_state.dictee != None:
|
171 |
with st.spinner("🚀 Dictée en cours de création..."):
|
172 |
if st.session_state.creationmodified == False:
|
@@ -191,22 +193,6 @@ if submitted or st.session_state.dictee != None:
|
|
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)
|
@@ -215,6 +201,12 @@ if submitted or st.session_state.dictee != None:
|
|
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()
|
|
|
167 |
longueur = st.slider("Longueur de la dictée (nombre de mots)", 50, 500, 200)
|
168 |
submitted = st.form_submit_button("🔮 Générer la Dictée", disabled=st.session_state.dicteecreation)
|
169 |
|
170 |
+
st.divider()
|
171 |
+
|
172 |
if submitted or st.session_state.dictee != None:
|
173 |
with st.spinner("🚀 Dictée en cours de création..."):
|
174 |
if st.session_state.creationmodified == False:
|
|
|
193 |
st.session_state.concatenated_audio_path = concatenate_audio(audio_urls)
|
194 |
concatenated_audio_path = st.session_state.concatenated_audio_path
|
195 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
st.markdown("## ✍️ Votre Dictée")
|
197 |
with st.form("dictee_form"):
|
198 |
dictee_user = st.text_area("Écrivez la dictée ici:", key="dictee_user", height=350)
|
|
|
201 |
if correct:
|
202 |
st.session_state.correction = correction_dictee(dictee, dictee_user)
|
203 |
st.rerun()
|
204 |
+
|
205 |
+
st.sidebar.markdown("## 📖 Dictée en entier")
|
206 |
+
st.sidebar.audio(concatenated_audio_path, format='audio/wav', start_time=0)
|
207 |
+
st.sidebar.markdown("## 📖 Phrases de la Dictée")
|
208 |
+
st.sidebar.markdown(f"**Phrase {idx + 1}:**")
|
209 |
+
st.sidebar.audio(audio_urls[idx], format='audio/wav')
|
210 |
|
211 |
if st.session_state.correction != None:
|
212 |
st.divider()
|