terry-li-hm
commited on
Commit
·
b30221e
1
Parent(s):
a54fc2d
Update sv.py
Browse files
sv.py
CHANGED
@@ -365,11 +365,18 @@ if __name__ == "__main__":
|
|
365 |
audio_path = "example/mtr.mp3" # Replace with your audio file path
|
366 |
language = "yue" # Set language to Cantonese
|
367 |
|
368 |
-
|
|
|
369 |
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
|
375 |
-
|
|
|
365 |
audio_path = "example/mtr.mp3" # Replace with your audio file path
|
366 |
language = "yue" # Set language to Cantonese
|
367 |
|
368 |
+
# Option to run only diarization
|
369 |
+
diarization_only = False # Set this to True if you want only diarization
|
370 |
|
371 |
+
if diarization_only:
|
372 |
+
diarization_segments = generate_diarization(audio_path)
|
373 |
+
# You can add code here to save or process the diarization results as needed
|
374 |
+
else:
|
375 |
+
result = process_audio(audio_path, language)
|
376 |
+
|
377 |
+
# Save the result to mtr.txt
|
378 |
+
output_path = "mtr.txt"
|
379 |
+
with open(output_path, "w", encoding="utf-8") as f:
|
380 |
+
f.write(result)
|
381 |
|
382 |
+
print(f"Diarization and transcription result has been saved to {output_path}")
|