petro_y commited on
Commit
efa7f0a
·
1 Parent(s): d278809
Files changed (2) hide show
  1. app.py +4 -6
  2. requirements.txt +3 -1
app.py CHANGED
@@ -1,19 +1,17 @@
1
  import os
 
2
  from pyannote.audio import Pipeline
3
  import gradio as gr
4
 
5
  # Retrieve the Hugging Face token from environment variables
6
  token = os.getenv("HUGGINGFACE_HUB_TOKEN")
7
  print(f"Token length: {len(token)}")
 
8
 
9
- if not token:
10
- raise ValueError("Hugging Face token is missing!")
11
-
12
- # Initialize the pipeline with the token
13
  pipeline = Pipeline.from_pretrained(
14
  "pyannote/speaker-diarization-3.1",
15
- use_auth_token=token
16
- )
17
 
18
  def diarization(audio_file):
19
  if pipeline is None:
 
1
  import os
2
+ from huggingface_hub import login
3
  from pyannote.audio import Pipeline
4
  import gradio as gr
5
 
6
  # Retrieve the Hugging Face token from environment variables
7
  token = os.getenv("HUGGINGFACE_HUB_TOKEN")
8
  print(f"Token length: {len(token)}")
9
+ login(token=os.getenv("HUGGINGFACE_HUB_TOKEN"))
10
 
11
+ # Then try initializing the pipeline
 
 
 
12
  pipeline = Pipeline.from_pretrained(
13
  "pyannote/speaker-diarization-3.1",
14
+ use_auth_token=True
 
15
 
16
  def diarization(audio_file):
17
  if pipeline is None:
requirements.txt CHANGED
@@ -1,2 +1,4 @@
1
  pyannote.audio
2
- gradio
 
 
 
1
  pyannote.audio
2
+ gradio
3
+
4
+ huggingface_hub