Update app.py
Browse files
app.py
CHANGED
@@ -193,7 +193,7 @@ def format_to_markdown(transcription_text, speaker_transcription, audio_duration
|
|
193 |
|
194 |
# Créer un dictionnaire pour les noms personnalisés
|
195 |
custom_names = {}
|
196 |
-
if speaker_names is not None:
|
197 |
for row in speaker_names:
|
198 |
if isinstance(row, dict):
|
199 |
speaker_id = row.get("Speaker ID")
|
@@ -202,6 +202,13 @@ def format_to_markdown(transcription_text, speaker_transcription, audio_duration
|
|
202 |
custom_names[speaker_id] = custom_name
|
203 |
elif isinstance(row, (list, tuple)) and len(row) == 2:
|
204 |
custom_names[row[0]] = row[1]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
|
206 |
print("custom_names créé :", custom_names)
|
207 |
|
@@ -234,6 +241,7 @@ def format_to_markdown(transcription_text, speaker_transcription, audio_duration
|
|
234 |
"""
|
235 |
print("Fin de format_to_markdown")
|
236 |
return formatted_output
|
|
|
237 |
|
238 |
def _return_yt_html_embed(yt_url):
|
239 |
video_id = yt_url.split("?v=")[-1]
|
|
|
193 |
|
194 |
# Créer un dictionnaire pour les noms personnalisés
|
195 |
custom_names = {}
|
196 |
+
if speaker_names is not None and isinstance(speaker_names, list):
|
197 |
for row in speaker_names:
|
198 |
if isinstance(row, dict):
|
199 |
speaker_id = row.get("Speaker ID")
|
|
|
202 |
custom_names[speaker_id] = custom_name
|
203 |
elif isinstance(row, (list, tuple)) and len(row) == 2:
|
204 |
custom_names[row[0]] = row[1]
|
205 |
+
elif speaker_names is not None:
|
206 |
+
# Traitement pour le cas où speaker_names est un DataFrame
|
207 |
+
for index, row in speaker_names.iterrows():
|
208 |
+
speaker_id = row.get("Speaker ID")
|
209 |
+
custom_name = row.get("Nom personnalisé")
|
210 |
+
if speaker_id and custom_name:
|
211 |
+
custom_names[speaker_id] = custom_name
|
212 |
|
213 |
print("custom_names créé :", custom_names)
|
214 |
|
|
|
241 |
"""
|
242 |
print("Fin de format_to_markdown")
|
243 |
return formatted_output
|
244 |
+
|
245 |
|
246 |
def _return_yt_html_embed(yt_url):
|
247 |
video_id = yt_url.split("?v=")[-1]
|