Update app.py
Browse files
app.py
CHANGED
|
@@ -131,9 +131,8 @@ if uploaded_file:
|
|
| 131 |
|
| 132 |
# 1. Diarization
|
| 133 |
try:
|
| 134 |
-
#
|
| 135 |
-
#
|
| 136 |
-
# or using the explicit 'pyannote/speaker-diarization-3.1' model ID if needed
|
| 137 |
pipeline = Pipeline.from_pretrained(
|
| 138 |
"pyannote/speaker-diarization-3.1",
|
| 139 |
use_auth_token=ACTIVE_HF_TOKEN
|
|
@@ -144,9 +143,18 @@ if uploaded_file:
|
|
| 144 |
|
| 145 |
diarization = pipeline("audio_optimized.m4a")
|
| 146 |
except Exception as e:
|
| 147 |
-
#
|
| 148 |
-
|
| 149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
|
| 151 |
# 2. Whisper Transcription
|
| 152 |
model = whisper.load_model("base")
|
|
|
|
| 131 |
|
| 132 |
# 1. Diarization
|
| 133 |
try:
|
| 134 |
+
# Direct fix for the specific 'unexpected keyword argument' error
|
| 135 |
+
# Use the most generic loading method possible
|
|
|
|
| 136 |
pipeline = Pipeline.from_pretrained(
|
| 137 |
"pyannote/speaker-diarization-3.1",
|
| 138 |
use_auth_token=ACTIVE_HF_TOKEN
|
|
|
|
| 143 |
|
| 144 |
diarization = pipeline("audio_optimized.m4a")
|
| 145 |
except Exception as e:
|
| 146 |
+
# Fallback for library versions that demand 'token' instead of 'use_auth_token'
|
| 147 |
+
try:
|
| 148 |
+
pipeline = Pipeline.from_pretrained(
|
| 149 |
+
"pyannote/speaker-diarization-3.1",
|
| 150 |
+
token=ACTIVE_HF_TOKEN
|
| 151 |
+
)
|
| 152 |
+
if torch.cuda.is_available():
|
| 153 |
+
pipeline.to(torch.device("cuda"))
|
| 154 |
+
diarization = pipeline("audio_optimized.m4a")
|
| 155 |
+
except Exception as e2:
|
| 156 |
+
st.error(f"Diarization Error: {e2}")
|
| 157 |
+
st.stop()
|
| 158 |
|
| 159 |
# 2. Whisper Transcription
|
| 160 |
model = whisper.load_model("base")
|