NickVerri commited on
Commit
76e1a3f
·
verified ·
1 Parent(s): 85c27a4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -137,14 +137,15 @@ if uploaded_file:
137
 
138
  # Attempt 1: Modern syntax (revision keyword + token keyword)
139
  try:
 
140
  pipeline = Pipeline.from_pretrained(
141
  model_id,
142
  revision="2.1",
143
- token=ACTIVE_HF_TOKEN
144
  )
145
  except Exception:
146
- # Attempt 2: Older syntax (use_auth_token)
147
  try:
 
148
  pipeline = Pipeline.from_pretrained(
149
  f"{model_id}@2.1",
150
  use_auth_token=ACTIVE_HF_TOKEN
@@ -157,8 +158,14 @@ if uploaded_file:
157
  )
158
 
159
  if pipeline is None:
160
- raise ValueError("Could not initialize the pyannote pipeline.")
161
-
 
 
 
 
 
 
162
  if torch.cuda.is_available():
163
  pipeline.to(torch.device("cuda"))
164
 
 
137
 
138
  # Attempt 1: Modern syntax (revision keyword + token keyword)
139
  try:
140
+ # Explicitly handle version 3.1+ requirement
141
  pipeline = Pipeline.from_pretrained(
142
  model_id,
143
  revision="2.1",
144
+ use_auth_token=ACTIVE_HF_TOKEN
145
  )
146
  except Exception:
 
147
  try:
148
+ # Attempt 2: Older syntax (use_auth_token without explicit revision keyword)
149
  pipeline = Pipeline.from_pretrained(
150
  f"{model_id}@2.1",
151
  use_auth_token=ACTIVE_HF_TOKEN
 
158
  )
159
 
160
  if pipeline is None:
161
+ # Last resort fallback for very new libraries that reject use_auth_token entirely
162
+ # If the above failed, try forcing 'token' keyword with revision
163
+ pipeline = Pipeline.from_pretrained(
164
+ model_id,
165
+ revision="2.1",
166
+ token=ACTIVE_HF_TOKEN
167
+ )
168
+
169
  if torch.cuda.is_available():
170
  pipeline.to(torch.device("cuda"))
171