NickVerri commited on
Commit
fad3735
·
verified ·
1 Parent(s): 381e053

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -6
app.py CHANGED
@@ -131,9 +131,8 @@ if uploaded_file:
131
 
132
  # 1. Diarization
133
  try:
134
- # Fix for pyannote.audio 3.1+: strict argument passing
135
- # We instantiate with just the token, letting the library resolve the version
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
- # Detailed error message for debugging
148
- st.error(f"Diarization Error: {e}")
149
- st.stop()
 
 
 
 
 
 
 
 
 
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")