Spaces:
Paused
Paused
rick
commited on
Commit
•
92465f3
1
Parent(s):
3694efb
amelioration UI/UX
Browse files- app.py +20 -1
- sound-effects/open-panel-side.mp3 +0 -0
- sound-effects/setting-tts-voice-select.mp3 +0 -0
app.py
CHANGED
@@ -348,8 +348,26 @@ def main():
|
|
348 |
"Abattre les barrières linguistiques entre les hommes."
|
349 |
]))
|
350 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
351 |
# Fonction de rappel pour le changement de(s) langue(s) de destination selectionnée(s)
|
352 |
def on_languages_change():
|
|
|
353 |
selected_language_names = st.session_state.language_selector
|
354 |
st.session_state.selected_languages = [
|
355 |
{"language": lang, "iso-639-1": convert_language_name_to_iso6391(lang)}
|
@@ -378,7 +396,8 @@ def main():
|
|
378 |
"Choisissez la voix TTS",
|
379 |
options=["alloy", "echo", "fable", "onyx", "nova", "shimmer"],
|
380 |
index=3, # "onyx" est à l'index 3
|
381 |
-
key="tts_voice"
|
|
|
382 |
)
|
383 |
st.checkbox(
|
384 |
"Activer TTS pour les entrées textuelles",
|
|
|
348 |
"Abattre les barrières linguistiques entre les hommes."
|
349 |
]))
|
350 |
|
351 |
+
#
|
352 |
+
def tts_voice_selection_change():
|
353 |
+
sound_effect = "sound-effects/setting-tts-voice-select.mp3"
|
354 |
+
# Jouer le son d'effet lors du changement de voix TTS
|
355 |
+
audio_file = open(sound_effect, "rb")
|
356 |
+
audio_bytes = audio_file.read()
|
357 |
+
with st.sidebar:
|
358 |
+
#st.markdown(
|
359 |
+
# f'<audio id=\"tts_voice_change_sound\" autoplay currentTime=\"0\" style=\"display:none\"><source src=\"data:audio/mp3;base64,{base64.b64encode(audio_bytes).decode()}\" type=\"audio/mp3\"></audio>',
|
360 |
+
# unsafe_allow_html=True
|
361 |
+
#)
|
362 |
+
st.audio(audio_bytes,
|
363 |
+
format="audio/mp3",
|
364 |
+
autoplay=True)
|
365 |
+
|
366 |
+
audio_file.close()
|
367 |
+
|
368 |
# Fonction de rappel pour le changement de(s) langue(s) de destination selectionnée(s)
|
369 |
def on_languages_change():
|
370 |
+
|
371 |
selected_language_names = st.session_state.language_selector
|
372 |
st.session_state.selected_languages = [
|
373 |
{"language": lang, "iso-639-1": convert_language_name_to_iso6391(lang)}
|
|
|
396 |
"Choisissez la voix TTS",
|
397 |
options=["alloy", "echo", "fable", "onyx", "nova", "shimmer"],
|
398 |
index=3, # "onyx" est à l'index 3
|
399 |
+
key="tts_voice",
|
400 |
+
on_change=tts_voice_selection_change
|
401 |
)
|
402 |
st.checkbox(
|
403 |
"Activer TTS pour les entrées textuelles",
|
sound-effects/open-panel-side.mp3
ADDED
Binary file (42.8 kB). View file
|
|
sound-effects/setting-tts-voice-select.mp3
ADDED
Binary file (42.8 kB). View file
|
|