Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse files
app.py
CHANGED
@@ -9,15 +9,11 @@ import numpy as np
|
|
9 |
import json
|
10 |
|
11 |
# Authenticate with Huggingface
|
12 |
-
|
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=
|
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."""
|