Spaces:
Runtime error
Runtime error
Update voice_analysis.py
Browse files- voice_analysis.py +6 -0
voice_analysis.py
CHANGED
|
@@ -11,6 +11,12 @@ def extract_audio_from_video(video_path):
|
|
| 11 |
return audio_path
|
| 12 |
|
| 13 |
def diarize_speakers(audio_path):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
pipeline = Pipeline.from_pretrained("pyannote/speaker-diarization-3.1", use_auth_token=py_annote_hf_token)
|
| 15 |
diarization = pipeline(audio_path)
|
| 16 |
return diarization
|
|
|
|
| 11 |
return audio_path
|
| 12 |
|
| 13 |
def diarize_speakers(audio_path):
|
| 14 |
+
# Load the token from the environment variable
|
| 15 |
+
hf_token = os.environ.get("HF_TOKEN")
|
| 16 |
+
|
| 17 |
+
if not hf_token:
|
| 18 |
+
raise ValueError("HF_TOKEN environment variable is not set. Please add it in your Hugging Face Space's Variables and secrets section.")
|
| 19 |
+
|
| 20 |
pipeline = Pipeline.from_pretrained("pyannote/speaker-diarization-3.1", use_auth_token=py_annote_hf_token)
|
| 21 |
diarization = pipeline(audio_path)
|
| 22 |
return diarization
|