Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,7 +27,7 @@ def youtube_url_to_text(url, model_id, language_choice):
|
|
| 27 |
return transcript, video_path
|
| 28 |
|
| 29 |
|
| 30 |
-
def speaker_diarization(url, model_id,
|
| 31 |
"""
|
| 32 |
Main function that downloads and converts a video to MP3 format, performs speech-to-text conversion using
|
| 33 |
a specified model, and returns the transcript along with the video path.
|
|
@@ -47,7 +47,7 @@ def speaker_diarization(url, model_id, device, num_speakers, min_speaker, max_sp
|
|
| 47 |
diarizer_model="pyannote/speaker-diarization",
|
| 48 |
use_auth_token="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",
|
| 49 |
chunk_length_s=30,
|
| 50 |
-
device=
|
| 51 |
)
|
| 52 |
|
| 53 |
audio_path = download_and_convert_to_mp3(url)
|
|
@@ -140,11 +140,6 @@ def speaker_diarization_app():
|
|
| 140 |
value="openai/whisper-large-v3",
|
| 141 |
label="Whisper Model",
|
| 142 |
)
|
| 143 |
-
device = gr.Dropdown(
|
| 144 |
-
choices=["cpu", "cuda", "mps"],
|
| 145 |
-
value="cuda",
|
| 146 |
-
label="Device",
|
| 147 |
-
)
|
| 148 |
num_speakers = gr.Number(value=2, label="Number of Speakers")
|
| 149 |
min_speaker = gr.Number(value=1, label="Minimum Number of Speakers")
|
| 150 |
max_speaker = gr.Number(value=2, label="Maximum Number of Speakers")
|
|
@@ -159,7 +154,6 @@ def speaker_diarization_app():
|
|
| 159 |
inputs=[
|
| 160 |
youtube_url_path,
|
| 161 |
whisper_model_id,
|
| 162 |
-
device,
|
| 163 |
num_speakers,
|
| 164 |
min_speaker,
|
| 165 |
max_speaker,
|
|
@@ -181,7 +175,6 @@ def speaker_diarization_app():
|
|
| 181 |
inputs=[
|
| 182 |
youtube_url_path,
|
| 183 |
whisper_model_id,
|
| 184 |
-
device,
|
| 185 |
num_speakers,
|
| 186 |
min_speaker,
|
| 187 |
max_speaker,
|
|
|
|
| 27 |
return transcript, video_path
|
| 28 |
|
| 29 |
|
| 30 |
+
def speaker_diarization(url, model_id, num_speakers, min_speaker, max_speaker):
|
| 31 |
"""
|
| 32 |
Main function that downloads and converts a video to MP3 format, performs speech-to-text conversion using
|
| 33 |
a specified model, and returns the transcript along with the video path.
|
|
|
|
| 47 |
diarizer_model="pyannote/speaker-diarization",
|
| 48 |
use_auth_token="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",
|
| 49 |
chunk_length_s=30,
|
| 50 |
+
device="cuda",
|
| 51 |
)
|
| 52 |
|
| 53 |
audio_path = download_and_convert_to_mp3(url)
|
|
|
|
| 140 |
value="openai/whisper-large-v3",
|
| 141 |
label="Whisper Model",
|
| 142 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
num_speakers = gr.Number(value=2, label="Number of Speakers")
|
| 144 |
min_speaker = gr.Number(value=1, label="Minimum Number of Speakers")
|
| 145 |
max_speaker = gr.Number(value=2, label="Maximum Number of Speakers")
|
|
|
|
| 154 |
inputs=[
|
| 155 |
youtube_url_path,
|
| 156 |
whisper_model_id,
|
|
|
|
| 157 |
num_speakers,
|
| 158 |
min_speaker,
|
| 159 |
max_speaker,
|
|
|
|
| 175 |
inputs=[
|
| 176 |
youtube_url_path,
|
| 177 |
whisper_model_id,
|
|
|
|
| 178 |
num_speakers,
|
| 179 |
min_speaker,
|
| 180 |
max_speaker,
|