Spaces:
Paused
Paused
rick
commited on
bug fixed now... not done...
Browse files- pages/main.py +22 -1
pages/main.py
CHANGED
|
@@ -146,6 +146,13 @@ def transcribe_segment(segment_path: str, language: Optional[str] = None) -> str
|
|
| 146 |
return transcript
|
| 147 |
except Exception as e:
|
| 148 |
print(f"Erreur lors de la transcription du segment {segment_path} : {e}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
return ""
|
| 150 |
|
| 151 |
def transcribe_audio(audio_file: Union[str, IO], language: Optional[str] = None) -> str:
|
|
@@ -172,7 +179,10 @@ def transcribe_audio(audio_file: Union[str, IO], language: Optional[str] = None)
|
|
| 172 |
full_transcript = ""
|
| 173 |
for i, segment in enumerate(segments):
|
| 174 |
status.update(label=f"Transcription du segment {i+1}/{len(segments)}...")
|
| 175 |
-
transcript = transcribe_segment(
|
|
|
|
|
|
|
|
|
|
| 176 |
full_transcript += f"{transcript} "
|
| 177 |
status.update(label="Transcription terminée", state="complete")
|
| 178 |
return full_transcript.strip()
|
|
@@ -595,6 +605,17 @@ def main_page():
|
|
| 595 |
show_visualizer=True,
|
| 596 |
key="vocal_chat_input"
|
| 597 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 598 |
if st.session_state.user_input:
|
| 599 |
|
| 600 |
# Réinitialiser l'état précédent
|
|
|
|
| 146 |
return transcript
|
| 147 |
except Exception as e:
|
| 148 |
print(f"Erreur lors de la transcription du segment {segment_path} : {e}")
|
| 149 |
+
print("\'"*3, end="")
|
| 150 |
+
print("\n# # #\n{}\n# # #\n".format(
|
| 151 |
+
language
|
| 152 |
+
),
|
| 153 |
+
end=""
|
| 154 |
+
)
|
| 155 |
+
print("\'"*3, end="")
|
| 156 |
return ""
|
| 157 |
|
| 158 |
def transcribe_audio(audio_file: Union[str, IO], language: Optional[str] = None) -> str:
|
|
|
|
| 179 |
full_transcript = ""
|
| 180 |
for i, segment in enumerate(segments):
|
| 181 |
status.update(label=f"Transcription du segment {i+1}/{len(segments)}...")
|
| 182 |
+
transcript = transcribe_segment(
|
| 183 |
+
segment,
|
| 184 |
+
language
|
| 185 |
+
)
|
| 186 |
full_transcript += f"{transcript} "
|
| 187 |
status.update(label="Transcription terminée", state="complete")
|
| 188 |
return full_transcript.strip()
|
|
|
|
| 605 |
show_visualizer=True,
|
| 606 |
key="vocal_chat_input"
|
| 607 |
)
|
| 608 |
+
if type(st.session_state.user_input) != type(None):
|
| 609 |
+
print("len of user_input: {0}".format(
|
| 610 |
+
len(st.session_state.user_input)
|
| 611 |
+
)
|
| 612 |
+
)
|
| 613 |
+
if type(st.session_state.audio) != type(None):
|
| 614 |
+
print("len of audio: {0}".format(
|
| 615 |
+
len(st.session_state.audio)
|
| 616 |
+
)
|
| 617 |
+
)
|
| 618 |
+
|
| 619 |
if st.session_state.user_input:
|
| 620 |
|
| 621 |
# Réinitialiser l'état précédent
|