Y-Mangoes commited on
Commit
740f2f9
·
verified ·
1 Parent(s): ed83bc4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -6
app.py CHANGED
@@ -9,15 +9,11 @@ import numpy as np
9
  import json
10
 
11
  # Authenticate with Huggingface
12
- HF_TOKEN = os.getenv("HF_TOKEN")
13
- if HF_TOKEN:
14
- login(HF_TOKEN)
15
- else:
16
- raise ValueError("Huggingface token not found. Set HF_TOKEN environment variable.")
17
 
18
  # Load the diarization pipeline
19
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
20
- pipeline = Pipeline.from_pretrained("pyannote/speaker-diarization-3.0", use_auth_token=HF_TOKEN).to(device)
21
 
22
  def preprocess_audio(audio_path):
23
  """Convert audio to mono, 16kHz WAV format suitable for pyannote."""
 
9
  import json
10
 
11
  # Authenticate with Huggingface
12
+ AUTH_TOKEN = os.getenv("HF_TOKEN")
 
 
 
 
13
 
14
  # Load the diarization pipeline
15
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
16
+ pipeline = Pipeline.from_pretrained("pyannote/speaker-diarization-3.0", use_auth_token = AUTH_TOKEN).to(device)
17
 
18
  def preprocess_audio(audio_path):
19
  """Convert audio to mono, 16kHz WAV format suitable for pyannote."""