Nitzantry1
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,15 @@
|
|
1 |
import gradio as gr
|
2 |
from pyannote.audio import Pipeline
|
3 |
|
4 |
-
#
|
5 |
-
pipeline = Pipeline.from_pretrained(
|
|
|
|
|
|
|
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(
|
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()
|