rick commited on
Commit
955d5f0
·
unverified ·
1 Parent(s): 55fc7d8

update audio final process (tts) and progress status

Browse files
Files changed (2) hide show
  1. app.py +33 -0
  2. ui_lang_support.json +4 -1
app.py CHANGED
@@ -626,6 +626,39 @@ def main():
626
  response_status.update(label=f'({target_language_name}) - {get_translation("erreur_traduction")}', state="error", expanded=False)
627
 
628
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
629
  # Configuration de la barre latérale
630
  with st.sidebar:
631
  st.logo("img/logo_2.png", icon_image="img/logo_2.png")
 
626
  response_status.update(label=f'({target_language_name}) - {get_translation("erreur_traduction")}', state="error", expanded=False)
627
 
628
 
629
+ if audio_list:
630
+ with st.status(f"{get_translation('concatenation_audio_en_cours')}", expanded=False) as audio_status:
631
+ audio_status.update(label=f"{get_translation('concatenation_audio_en_cours')}", state="running", expanded=False)
632
+ try:
633
+ final_audio = concatenate_audio_files(audio_list)
634
+ with st.container(border=True):
635
+
636
+ # Générer un nom de fichier unique
637
+ timestamp = time.strftime("%Y%m%d-%H%M%S")
638
+ langues = "_".join([lang["iso-639-1"] for lang in st.session_state.selected_languages])
639
+ nom_fichier = f"reponse_audio_{langues}_{timestamp}.mp3"
640
+
641
+
642
+ st.audio(final_audio, format="audio/mp3", autoplay=st.session_state.autoplay_tts)
643
+
644
+ st.download_button(
645
+ label=f"📥 {get_translation('telecharger_audio')}",
646
+ data=final_audio,
647
+ file_name=nom_fichier,
648
+ mime="audio/mp3",
649
+ use_container_width=True,
650
+ type="primary",
651
+ key=f"download_button_{langues}_{timestamp}",
652
+ )
653
+
654
+
655
+ audio_status.update(label=f"{get_translation('concatenation_audio_terminee')}", state="complete", expanded=True)
656
+ except Exception as e:
657
+ st.error(f"{get_translation('erreur_concatenation_audio')} : {str(e)}")
658
+ audio_status.update(label=f"{get_translation('erreur_concatenation_audio')} : {str(e)}", state="error", expanded=True)
659
+
660
+
661
+
662
  # Configuration de la barre latérale
663
  with st.sidebar:
664
  st.logo("img/logo_2.png", icon_image="img/logo_2.png")
ui_lang_support.json CHANGED
@@ -41,7 +41,10 @@
41
  "traduction_terminee": "Traduction terminée !",
42
  "synthese_vocale_en_cours": "Synthèse vocale en cours...",
43
  "erreur_synthese_vocale": "Une erreur s'est produite lors de la synthèse vocale : {}",
44
- "synthese_vocale_terminee": "Synthèse vocale terminée !"
 
 
 
45
  },
46
  "Afrikaans": {
47
  "titre": "DEMORRHA APP - weergawe 1",
 
41
  "traduction_terminee": "Traduction terminée !",
42
  "synthese_vocale_en_cours": "Synthèse vocale en cours...",
43
  "erreur_synthese_vocale": "Une erreur s'est produite lors de la synthèse vocale : {}",
44
+ "synthese_vocale_terminee": "Synthèse vocale terminée !",
45
+ "concatenation_audio_en_cours": "Concaténation audio en cours...",
46
+ "erreur_concatenation_audio": "Une erreur s'est produite lors de la concaténation audio : {}",
47
+ "concatenation_audio_terminee": "Concaténation audio terminée !"
48
  },
49
  "Afrikaans": {
50
  "titre": "DEMORRHA APP - weergawe 1",