Spaces:
Sleeping
Sleeping
Update tools/audio_transcriber.py
Browse files
tools/audio_transcriber.py
CHANGED
|
@@ -9,7 +9,7 @@ from nemo.collections.asr.models import ASRModel
|
|
| 9 |
# Global model cache to avoid reloading
|
| 10 |
_MODEL_CACHE = {}
|
| 11 |
|
| 12 |
-
def get_model(model_name="nvidia/parakeet-tdt-0.6b-
|
| 13 |
"""Get or load the ASR model."""
|
| 14 |
if model_name not in _MODEL_CACHE:
|
| 15 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
@@ -45,7 +45,7 @@ def generate_srt_content(segment_timestamps: list) -> str:
|
|
| 45 |
srt_content.append("")
|
| 46 |
return "\n".join(srt_content)
|
| 47 |
|
| 48 |
-
def transcribe_audio_to_srt(audio_path: str, output_srt_path: str, model_name="nvidia/parakeet-tdt-0.6b-
|
| 49 |
"""
|
| 50 |
Transcribe an audio file and save it as an SRT file.
|
| 51 |
|
|
|
|
| 9 |
# Global model cache to avoid reloading
|
| 10 |
_MODEL_CACHE = {}
|
| 11 |
|
| 12 |
+
def get_model(model_name="nvidia/parakeet-tdt-0.6b-v3"):
|
| 13 |
"""Get or load the ASR model."""
|
| 14 |
if model_name not in _MODEL_CACHE:
|
| 15 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
|
| 45 |
srt_content.append("")
|
| 46 |
return "\n".join(srt_content)
|
| 47 |
|
| 48 |
+
def transcribe_audio_to_srt(audio_path: str, output_srt_path: str, model_name="nvidia/parakeet-tdt-0.6b-v3") -> str:
|
| 49 |
"""
|
| 50 |
Transcribe an audio file and save it as an SRT file.
|
| 51 |
|