Update app.py
Browse files
app.py
CHANGED
|
@@ -101,14 +101,17 @@ def process_transcription(*args):
|
|
| 101 |
pass # Consommer le générateur jusqu'à la fin
|
| 102 |
simplified_diarization = simplify_diarization_output(speaker_transcription)
|
| 103 |
num_speakers = count_unique_speakers(speaker_transcription)
|
| 104 |
-
|
|
|
|
| 105 |
return progress_message, raw_text, simplified_diarization, num_speakers, speaker_names
|
| 106 |
|
|
|
|
| 107 |
def process_yt_transcription(*args):
|
| 108 |
html_embed, raw_text, speaker_transcription = yt_transcribe(*args)
|
| 109 |
simplified_diarization = simplify_diarization_output(speaker_transcription)
|
| 110 |
num_speakers = count_unique_speakers(speaker_transcription)
|
| 111 |
-
|
|
|
|
| 112 |
return html_embed, raw_text, simplified_diarization, num_speakers, speaker_names
|
| 113 |
|
| 114 |
|
|
@@ -187,10 +190,10 @@ def format_to_markdown(transcription_text, speaker_transcription, audio_duration
|
|
| 187 |
"Contexte": context if context else "[non spécifié]"
|
| 188 |
}
|
| 189 |
|
| 190 |
-
#
|
| 191 |
if speaker_names is not None:
|
| 192 |
-
for
|
| 193 |
-
metadata[
|
| 194 |
|
| 195 |
metadata_text = "\n".join([f"- **{key}** : '{value}'" for key, value in metadata.items()])
|
| 196 |
|
|
|
|
| 101 |
pass # Consommer le générateur jusqu'à la fin
|
| 102 |
simplified_diarization = simplify_diarization_output(speaker_transcription)
|
| 103 |
num_speakers = count_unique_speakers(speaker_transcription)
|
| 104 |
+
# Modifier cette ligne pour créer une liste de listes au lieu d'une liste de dictionnaires
|
| 105 |
+
speaker_names = [[f"SPEAKER_{i:02d}", f"SPEAKER_{i:02d}"] for i in range(num_speakers)]
|
| 106 |
return progress_message, raw_text, simplified_diarization, num_speakers, speaker_names
|
| 107 |
|
| 108 |
+
# Faire la même modification dans process_yt_transcription
|
| 109 |
def process_yt_transcription(*args):
|
| 110 |
html_embed, raw_text, speaker_transcription = yt_transcribe(*args)
|
| 111 |
simplified_diarization = simplify_diarization_output(speaker_transcription)
|
| 112 |
num_speakers = count_unique_speakers(speaker_transcription)
|
| 113 |
+
# Modifier cette ligne de la même manière
|
| 114 |
+
speaker_names = [[f"SPEAKER_{i:02d}", f"SPEAKER_{i:02d}"] for i in range(num_speakers)]
|
| 115 |
return html_embed, raw_text, simplified_diarization, num_speakers, speaker_names
|
| 116 |
|
| 117 |
|
|
|
|
| 190 |
"Contexte": context if context else "[non spécifié]"
|
| 191 |
}
|
| 192 |
|
| 193 |
+
# Modifier cette partie pour traiter la nouvelle structure de speaker_names
|
| 194 |
if speaker_names is not None:
|
| 195 |
+
for speaker_id, custom_name in speaker_names:
|
| 196 |
+
metadata[speaker_id] = custom_name
|
| 197 |
|
| 198 |
metadata_text = "\n".join([f"- **{key}** : '{value}'" for key, value in metadata.items()])
|
| 199 |
|