Spaces:
Running
on
Zero
Running
on
Zero
Update whisper_cs_dev.py
Browse filesAdded elapsed secs counter
- whisper_cs_dev.py +8 -1
whisper_cs_dev.py
CHANGED
@@ -6,7 +6,7 @@ import re
|
|
6 |
import whisper_timestamped as whisper_ts
|
7 |
from faster_whisper import WhisperModel
|
8 |
from settings import DEBUG_MODE, MODEL_PATH_V2_FAST, MODEL_PATH_V2, LEFT_CHANNEL_TEMP_PATH, RIGHT_CHANNEL_TEMP_PATH, FAKE_AUDIO_PATH, RESAMPLING_FREQ
|
9 |
-
|
10 |
|
11 |
def get_settings():
|
12 |
|
@@ -303,6 +303,8 @@ def generate(audio_path, use_v2_fast):
|
|
303 |
|
304 |
if DEBUG_MODE: print(f"Entering generate function...")
|
305 |
|
|
|
|
|
306 |
device, compute_type = get_settings()
|
307 |
model, fake_model = load_model(use_v2_fast, device, compute_type)
|
308 |
split_input_stereo_channels(audio_path)
|
@@ -311,6 +313,11 @@ def generate(audio_path, use_v2_fast):
|
|
311 |
output = post_process_transcripts(left_result, right_result, use_v2_fast)
|
312 |
cleanup_temp_files(LEFT_CHANNEL_TEMP_PATH, RIGHT_CHANNEL_TEMP_PATH)
|
313 |
|
|
|
|
|
|
|
|
|
|
|
314 |
if DEBUG_MODE: print(f"Exited generate function.")
|
315 |
|
316 |
return output
|
|
|
6 |
import whisper_timestamped as whisper_ts
|
7 |
from faster_whisper import WhisperModel
|
8 |
from settings import DEBUG_MODE, MODEL_PATH_V2_FAST, MODEL_PATH_V2, LEFT_CHANNEL_TEMP_PATH, RIGHT_CHANNEL_TEMP_PATH, FAKE_AUDIO_PATH, RESAMPLING_FREQ
|
9 |
+
import time
|
10 |
|
11 |
def get_settings():
|
12 |
|
|
|
303 |
|
304 |
if DEBUG_MODE: print(f"Entering generate function...")
|
305 |
|
306 |
+
start = time.time()
|
307 |
+
|
308 |
device, compute_type = get_settings()
|
309 |
model, fake_model = load_model(use_v2_fast, device, compute_type)
|
310 |
split_input_stereo_channels(audio_path)
|
|
|
313 |
output = post_process_transcripts(left_result, right_result, use_v2_fast)
|
314 |
cleanup_temp_files(LEFT_CHANNEL_TEMP_PATH, RIGHT_CHANNEL_TEMP_PATH)
|
315 |
|
316 |
+
end = time.time()
|
317 |
+
elapsed_secs = end - start
|
318 |
+
|
319 |
+
if DEBUG_MODE: print(f"elapsed_secs: {elapsed_secs}")
|
320 |
+
|
321 |
if DEBUG_MODE: print(f"Exited generate function.")
|
322 |
|
323 |
return output
|