Spaces:
Runtime error
Runtime error
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -16,10 +16,16 @@ def diarize_audio(audio_file, model_name, num_speakers, min_speakers, max_speake
|
|
| 16 |
try:
|
| 17 |
# Gérer le chemin du fichier audio (Gradio peut retourner un tuple ou un string)
|
| 18 |
if isinstance(audio_file, tuple):
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
elif hasattr(audio_file, 'name'):
|
|
|
|
| 21 |
audio_path = audio_file.name
|
| 22 |
else:
|
|
|
|
| 23 |
audio_path = str(audio_file)
|
| 24 |
|
| 25 |
if not os.path.exists(audio_path):
|
|
|
|
| 16 |
try:
|
| 17 |
# Gérer le chemin du fichier audio (Gradio peut retourner un tuple ou un string)
|
| 18 |
if isinstance(audio_file, tuple):
|
| 19 |
+
# Gradio Audio avec type="filepath" retourne (sample_rate, filepath)
|
| 20 |
+
audio_path = audio_file[1] if len(audio_file) > 1 else audio_file[0]
|
| 21 |
+
elif isinstance(audio_file, str):
|
| 22 |
+
# C'est déjà un chemin de fichier
|
| 23 |
+
audio_path = audio_file
|
| 24 |
elif hasattr(audio_file, 'name'):
|
| 25 |
+
# Objet avec attribut name
|
| 26 |
audio_path = audio_file.name
|
| 27 |
else:
|
| 28 |
+
# Fallback
|
| 29 |
audio_path = str(audio_file)
|
| 30 |
|
| 31 |
if not os.path.exists(audio_path):
|