Update app.py
Browse files
app.py
CHANGED
@@ -118,37 +118,42 @@ if submitted or 'dictee' in st.session_state:
|
|
118 |
dictee = st.session_state.dictee
|
119 |
st.session_state.expanded = False
|
120 |
st.divider()
|
121 |
-
st.spinner(
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
del st.session_state['expandedmodified']
|
|
|
126 |
if mode.startswith("S'entrainer"):
|
127 |
if 'audio_urls' not in st.session_state:
|
128 |
-
st.
|
|
|
129 |
audio_urls = st.session_state.audio_urls
|
130 |
if 'concatenated_audio_path' not in st.session_state:
|
131 |
-
st.
|
|
|
132 |
concatenated_audio_path = st.session_state.concatenated_audio_path
|
133 |
|
134 |
col1, col2 = st.columns(2)
|
135 |
with col1:
|
136 |
st.audio(concatenated_audio_path, format='audio/wav', start_time=0)
|
137 |
-
with st.expander("Phrases de la Dictée"):
|
138 |
for idx, url in enumerate(audio_urls, start=1):
|
139 |
st.markdown(f"**Phrase {idx}:**")
|
140 |
st.audio(url, format='audio/wav')
|
141 |
|
142 |
with col2:
|
|
|
143 |
dictee_user = st.text_area("Écrivez la dictée ici:", key="dictee_user")
|
144 |
-
if st.button("Correction", key="submit_correction"):
|
145 |
-
st.spinner(
|
146 |
-
|
147 |
|
148 |
if 'correction' in st.session_state:
|
149 |
-
st.markdown("### Voici la correction (*Par IA*) :")
|
150 |
st.markdown(st.session_state.correction)
|
151 |
|
152 |
elif mode.startswith("Entrainer"):
|
153 |
-
st.markdown("### Voici la dictée :")
|
154 |
st.markdown(dictee)
|
|
|
|
118 |
dictee = st.session_state.dictee
|
119 |
st.session_state.expanded = False
|
120 |
st.divider()
|
121 |
+
with st.spinner("🚀 Dictée en cours de création..."):
|
122 |
+
if not st.session_state.expandedmodified:
|
123 |
+
st.session_state.expandedmodified = True
|
124 |
+
st.rerun()
|
125 |
del st.session_state['expandedmodified']
|
126 |
+
|
127 |
if mode.startswith("S'entrainer"):
|
128 |
if 'audio_urls' not in st.session_state:
|
129 |
+
with st.spinner("🔊 Préparation des audios..."):
|
130 |
+
st.session_state.audio_urls = dictee_to_audio_segmented(dictee)
|
131 |
audio_urls = st.session_state.audio_urls
|
132 |
if 'concatenated_audio_path' not in st.session_state:
|
133 |
+
with st.spinner("🎵 Assemblage de l'audio complet..."):
|
134 |
+
st.session_state.concatenated_audio_path = concatenate_audio(audio_urls)
|
135 |
concatenated_audio_path = st.session_state.concatenated_audio_path
|
136 |
|
137 |
col1, col2 = st.columns(2)
|
138 |
with col1:
|
139 |
st.audio(concatenated_audio_path, format='audio/wav', start_time=0)
|
140 |
+
with st.expander("📖 Phrases de la Dictée"):
|
141 |
for idx, url in enumerate(audio_urls, start=1):
|
142 |
st.markdown(f"**Phrase {idx}:**")
|
143 |
st.audio(url, format='audio/wav')
|
144 |
|
145 |
with col2:
|
146 |
+
st.markdown("## ✍️ Votre Dictée")
|
147 |
dictee_user = st.text_area("Écrivez la dictée ici:", key="dictee_user")
|
148 |
+
if st.button("📝 Correction", key="submit_correction"):
|
149 |
+
with st.spinner("🤖 Dictée en cours de correction..."):
|
150 |
+
st.session_state.correction = correction_dictee(dictee, dictee_user)
|
151 |
|
152 |
if 'correction' in st.session_state:
|
153 |
+
st.markdown("### 🎉 Voici la correction (*Par IA*) :")
|
154 |
st.markdown(st.session_state.correction)
|
155 |
|
156 |
elif mode.startswith("Entrainer"):
|
157 |
+
st.markdown("### 📚 Voici la dictée :")
|
158 |
st.markdown(dictee)
|
159 |
+
|