Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
627ee40
1
Parent(s):
cd6277e
moved model instantiation outside of function
Browse files
app.py
CHANGED
|
@@ -114,6 +114,9 @@ def convert_audio_to_mono_16khz(input_path, output_path):
|
|
| 114 |
print(f"Audio converted successfully to mono, 16kHz at: {output_path}")
|
| 115 |
except Exception as e:
|
| 116 |
print(f"Error converting audio: {e}")
|
|
|
|
|
|
|
|
|
|
| 117 |
@spaces.GPU
|
| 118 |
def subtitle_video(input_file):
|
| 119 |
# ------------------------------------------------------------------------------------------------------------------------------
|
|
@@ -147,7 +150,7 @@ def subtitle_video(input_file):
|
|
| 147 |
my_clip.audio.write_audiofile(f'experiments/{name}/audio_file.wav', codec="mp3")
|
| 148 |
|
| 149 |
# Instantiate parakeet model
|
| 150 |
-
model =
|
| 151 |
|
| 152 |
# convert to format parakeet can interpret
|
| 153 |
convert_audio_to_mono_16khz(f'experiments/{name}/audio_file.wav', f'experiments/{name}/audio_file.wav')
|
|
|
|
| 114 |
print(f"Audio converted successfully to mono, 16kHz at: {output_path}")
|
| 115 |
except Exception as e:
|
| 116 |
print(f"Error converting audio: {e}")
|
| 117 |
+
|
| 118 |
+
asr_model = nemo_asr.models.ASRModel.from_pretrained(model_name="nvidia/parakeet-tdt-0.6b-v3")
|
| 119 |
+
|
| 120 |
@spaces.GPU
|
| 121 |
def subtitle_video(input_file):
|
| 122 |
# ------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
| 150 |
my_clip.audio.write_audiofile(f'experiments/{name}/audio_file.wav', codec="mp3")
|
| 151 |
|
| 152 |
# Instantiate parakeet model
|
| 153 |
+
model = asr_model
|
| 154 |
|
| 155 |
# convert to format parakeet can interpret
|
| 156 |
convert_audio_to_mono_16khz(f'experiments/{name}/audio_file.wav', f'experiments/{name}/audio_file.wav')
|