Nitzantry1 commited on
Commit
357116d
ยท
verified ยท
1 Parent(s): 04a712c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -1,11 +1,15 @@
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(audio_path):
 
9
  diarization = pipeline(audio_path)
10
  results = []
11
  for turn, _, speaker in diarization.itertracks(yield_label=True):
@@ -15,10 +19,11 @@ def diarize_audio(audio_path):
15
  # ื”ื’ื“ืจืช ืžืžืฉืง Gradio
16
  interface = gr.Interface(
17
  fn=diarize_audio,
18
- inputs=gr.Audio(source="upload", type="filepath"),
19
  outputs="text",
20
- title="Speaker Diarization"
 
21
  )
22
 
23
- # ื”ืจืฆืช ื”ืืคืœื™ืงืฆื™ื”
24
  interface.launch()
 
1
  import gradio as gr
2
  from pyannote.audio import Pipeline
3
 
4
+ # ื˜ืขืŸ ืืช ื”ืžื•ื“ืœ ืฉืœ pyannote ืขื ื˜ื•ืงืŸ ื’ื™ืฉื”
5
+ pipeline = Pipeline.from_pretrained(
6
+ "pyannote/speaker-diarization",
7
+ use_auth_token="YOUR_HF_AUTH_TOKEN" # ื”ื—ืœืฃ ื‘ื˜ื•ืงืŸ ืฉืœืš
8
+ )
9
 
10
  # ืคื•ื ืงืฆื™ื” ืœืขื™ื‘ื•ื“ ืงื•ื‘ืฅ ืื•ื“ื™ื•
11
  def diarize_audio(audio_path):
12
+ # ื‘ืฆืข ื—ืœื•ืงืช ื“ื•ื‘ืจื™ื ืขื pyannote
13
  diarization = pipeline(audio_path)
14
  results = []
15
  for turn, _, speaker in diarization.itertracks(yield_label=True):
 
19
  # ื”ื’ื“ืจืช ืžืžืฉืง Gradio
20
  interface = gr.Interface(
21
  fn=diarize_audio,
22
+ inputs=gr.Audio(type="filepath"), # ืฉื™ืžื•ืฉ ื‘-type="filepath"
23
  outputs="text",
24
+ title="Speaker Diarization",
25
+ description="Upload an audio file to perform speaker diarization."
26
  )
27
 
28
+ # ื”ืคืขืœืช ื”ื™ื™ืฉื•ื
29
  interface.launch()