Spaces:
Paused
Paused
rick
commited on
bug fixed now... not done...
Browse files- pages/main.py +31 -6
pages/main.py
CHANGED
|
@@ -724,7 +724,6 @@ def main_page():
|
|
| 724 |
audio.export(temp_audio.name, format="wav")
|
| 725 |
st.write(f"Frame rate: {audio.frame_rate}, Frame width: {audio.frame_width}, Duration: {audio.duration_seconds} seconds")
|
| 726 |
|
| 727 |
-
|
| 728 |
# Transcrire l'audio en texte
|
| 729 |
transcription = transcribe_audio(temp_audio, language=st.session_state.language_detected)
|
| 730 |
# Detecter la langue du texte transcrit (si la langue source n'est pas détectée)
|
|
@@ -766,9 +765,7 @@ def main_page():
|
|
| 766 |
transcription, operation_prompt, st.session_state.enable_tts_for_input_from_audio_record,
|
| 767 |
system_prompt=system_prompt
|
| 768 |
)
|
| 769 |
-
|
| 770 |
-
del operation_prompt
|
| 771 |
-
del system_prompt
|
| 772 |
for response_chunk in response_generator:
|
| 773 |
message_placeholder.markdown(response_chunk)
|
| 774 |
end_response = response_generator.close()
|
|
@@ -777,7 +774,7 @@ def main_page():
|
|
| 777 |
|
| 778 |
if st.session_state.enable_tts_for_input_from_audio_record:
|
| 779 |
tts_audio, tts_duration = process_tts_message(st.session_state.full_response)
|
| 780 |
-
|
| 781 |
if tts_audio:
|
| 782 |
audio_list.append((tts_audio, tts_duration))
|
| 783 |
else:
|
|
@@ -785,7 +782,7 @@ def main_page():
|
|
| 785 |
|
| 786 |
if audio_list:
|
| 787 |
final_audio = concatenate_audio_files(audio_list)
|
| 788 |
-
|
| 789 |
with st.container(border=True):
|
| 790 |
|
| 791 |
# Générer un nom de fichier unique
|
|
@@ -805,6 +802,34 @@ def main_page():
|
|
| 805 |
key=f"download_button_{langues}_{timestamp}",
|
| 806 |
)
|
| 807 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 808 |
|
| 809 |
# Configuration de la barre latérale
|
| 810 |
with st.sidebar:
|
|
|
|
| 724 |
audio.export(temp_audio.name, format="wav")
|
| 725 |
st.write(f"Frame rate: {audio.frame_rate}, Frame width: {audio.frame_width}, Duration: {audio.duration_seconds} seconds")
|
| 726 |
|
|
|
|
| 727 |
# Transcrire l'audio en texte
|
| 728 |
transcription = transcribe_audio(temp_audio, language=st.session_state.language_detected)
|
| 729 |
# Detecter la langue du texte transcrit (si la langue source n'est pas détectée)
|
|
|
|
| 765 |
transcription, operation_prompt, st.session_state.enable_tts_for_input_from_audio_record,
|
| 766 |
system_prompt=system_prompt
|
| 767 |
)
|
| 768 |
+
|
|
|
|
|
|
|
| 769 |
for response_chunk in response_generator:
|
| 770 |
message_placeholder.markdown(response_chunk)
|
| 771 |
end_response = response_generator.close()
|
|
|
|
| 774 |
|
| 775 |
if st.session_state.enable_tts_for_input_from_audio_record:
|
| 776 |
tts_audio, tts_duration = process_tts_message(st.session_state.full_response)
|
| 777 |
+
|
| 778 |
if tts_audio:
|
| 779 |
audio_list.append((tts_audio, tts_duration))
|
| 780 |
else:
|
|
|
|
| 782 |
|
| 783 |
if audio_list:
|
| 784 |
final_audio = concatenate_audio_files(audio_list)
|
| 785 |
+
|
| 786 |
with st.container(border=True):
|
| 787 |
|
| 788 |
# Générer un nom de fichier unique
|
|
|
|
| 802 |
key=f"download_button_{langues}_{timestamp}",
|
| 803 |
)
|
| 804 |
|
| 805 |
+
if 'transcription' in locals():
|
| 806 |
+
del transcription
|
| 807 |
+
if 'operation_prompt' in locals():
|
| 808 |
+
del operation_prompt
|
| 809 |
+
if 'system_prompt' in locals():
|
| 810 |
+
del system_prompt
|
| 811 |
+
if 'audio_list' in locals():
|
| 812 |
+
del audio_list
|
| 813 |
+
if "full_response" in st.session_state:
|
| 814 |
+
del st.session_state["full_response"]
|
| 815 |
+
if "tts_audio" in locals():
|
| 816 |
+
del tts_audio
|
| 817 |
+
if 'tts_duration' in locals():
|
| 818 |
+
del tts_duration
|
| 819 |
+
if 'timestamp' in locals():
|
| 820 |
+
del timestamp
|
| 821 |
+
if 'langues' in locals():
|
| 822 |
+
del langues
|
| 823 |
+
if 'nom_fichier' in locals():
|
| 824 |
+
del nom_fichier
|
| 825 |
+
if 'final_audio' in locals():
|
| 826 |
+
del final_audio
|
| 827 |
+
if 'response_generator' in locals():
|
| 828 |
+
del response_generator
|
| 829 |
+
if 'end_response' in locals():
|
| 830 |
+
del end_response
|
| 831 |
+
|
| 832 |
+
# if '' in locals():
|
| 833 |
|
| 834 |
# Configuration de la barre latérale
|
| 835 |
with st.sidebar:
|