Nitzantry1 commited on
Commit
30323fc
ยท
verified ยท
1 Parent(s): 3ab5767

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -1,8 +1,12 @@
1
  import gradio as gr
2
  from pyannote.audio import Pipeline
 
3
 
4
- # ื˜ื•ืขืŸ ืืช ื”ืžื•ื“ืœ ืฉืœ Pyannote ืœื–ื™ื”ื•ื™ ื“ื•ื‘ืจื™ื
5
- pipeline = Pipeline.from_pretrained("pyannote/speaker-diarization")
 
 
 
6
 
7
  # ืคื•ื ืงืฆื™ื” ืœื‘ื™ืฆื•ืข ื–ื™ื”ื•ื™ ื“ื•ื‘ืจื™ื
8
  def diarize(audio_file):
@@ -19,7 +23,7 @@ def diarize(audio_file):
19
  # ื”ื’ื“ืจืช ืžืžืฉืง Gradio
20
  interface = gr.Interface(
21
  fn=diarize,
22
- inputs=gr.Audio(source="upload", type="filepath"),
23
  outputs="json",
24
  description="Upload an audio file to get speaker diarization (timestamps and speaker IDs only)."
25
  )
 
1
  import gradio as gr
2
  from pyannote.audio import Pipeline
3
+ import os
4
 
5
+ # ื˜ื•ืขืŸ ืืช ื”-Token ืžืžืขืจื›ืช ืžืฉืชื ื™ ื”ืกื‘ื™ื‘ื”
6
+ auth_token = os.getenv("HF_AUTH_TOKEN")
7
+
8
+ # ื˜ื•ืขืŸ ืืช ื”ืžื•ื“ืœ ืฉืœ Pyannote ืœื–ื™ื”ื•ื™ ื“ื•ื‘ืจื™ื ืขื ื”-Token
9
+ pipeline = Pipeline.from_pretrained("pyannote/speaker-diarization", use_auth_token=auth_token)
10
 
11
  # ืคื•ื ืงืฆื™ื” ืœื‘ื™ืฆื•ืข ื–ื™ื”ื•ื™ ื“ื•ื‘ืจื™ื
12
  def diarize(audio_file):
 
23
  # ื”ื’ื“ืจืช ืžืžืฉืง Gradio
24
  interface = gr.Interface(
25
  fn=diarize,
26
+ inputs=gr.Audio(type="filepath"), # ืฉื™ืžื•ืฉ ื‘ืคืจืžื˜ืจ ื”ืžืชืื™ื ืฉืœ Gradio
27
  outputs="json",
28
  description="Upload an audio file to get speaker diarization (timestamps and speaker IDs only)."
29
  )