Spaces:
Running
on
Zero
Running
on
Zero
fallback to spk diaraization 2.1 if error
Browse files
app.py
CHANGED
@@ -105,10 +105,18 @@ def get_diarization_pipe():
|
|
105 |
if dar_pipe is None:
|
106 |
# Pull token from environment (HF_TOKEN or HUGGINGFACE_TOKEN)
|
107 |
token = os.getenv("HF_TOKEN") or os.getenv("HUGGINGFACE_TOKEN")
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
return dar_pipe
|
113 |
|
114 |
# —————— Transcription Functions ——————
|
|
|
105 |
if dar_pipe is None:
|
106 |
# Pull token from environment (HF_TOKEN or HUGGINGFACE_TOKEN)
|
107 |
token = os.getenv("HF_TOKEN") or os.getenv("HUGGINGFACE_TOKEN")
|
108 |
+
# Attempt to load the latest 3.1 pipeline, fallback to 2.1 if gated segmentation-3.0 isn't accepted
|
109 |
+
try:
|
110 |
+
dar_pipe = DiarizationPipeline.from_pretrained(
|
111 |
+
"pyannote/speaker-diarization-3.1",
|
112 |
+
use_auth_token=token or True
|
113 |
+
)
|
114 |
+
except Exception as e:
|
115 |
+
print(f"Failed to load pyannote/speaker-diarization-3.1: {e} Falling back to pyannote/[email protected].")
|
116 |
+
dar_pipe = DiarizationPipeline.from_pretrained(
|
117 |
+
"pyannote/[email protected]",
|
118 |
+
use_auth_token=token or True
|
119 |
+
)
|
120 |
return dar_pipe
|
121 |
|
122 |
# —————— Transcription Functions ——————
|