Spaces:
Running
Running
jhj0517
commited on
Commit
·
c7ebe8c
1
Parent(s):
e730b1b
Post cache
Browse files
modules/whisper/whisper_base.py
CHANGED
@@ -103,11 +103,6 @@ class WhisperBase(ABC):
|
|
103 |
params = TranscriptionPipelineParams.from_list(list(pipeline_params))
|
104 |
bgm_params, vad_params, whisper_params, diarization_params = params.bgm_separation, params.vad, params.whisper, params.diarization
|
105 |
|
106 |
-
self.cache_parameters(
|
107 |
-
params=params,
|
108 |
-
add_timestamp=add_timestamp
|
109 |
-
)
|
110 |
-
|
111 |
if whisper_params.lang is None:
|
112 |
pass
|
113 |
elif whisper_params.lang == AUTOMATIC_DETECTION:
|
@@ -176,6 +171,11 @@ class WhisperBase(ABC):
|
|
176 |
device=diarization_params.device
|
177 |
)
|
178 |
elapsed_time += elapsed_time_diarization
|
|
|
|
|
|
|
|
|
|
|
179 |
return result, elapsed_time
|
180 |
|
181 |
def transcribe_file(self,
|
@@ -521,12 +521,18 @@ class WhisperBase(ABC):
|
|
521 |
add_timestamp: bool
|
522 |
):
|
523 |
"""cache parameters to the yaml file"""
|
|
|
524 |
cached_params = load_yaml(DEFAULT_PARAMETERS_CONFIG_PATH)
|
525 |
param_to_cache = params.to_dict()
|
526 |
|
|
|
|
|
527 |
cached_yaml = {**cached_params, **param_to_cache}
|
528 |
cached_yaml["whisper"]["add_timestamp"] = add_timestamp
|
529 |
|
|
|
|
|
|
|
530 |
save_yaml(cached_yaml, DEFAULT_PARAMETERS_CONFIG_PATH)
|
531 |
|
532 |
@staticmethod
|
|
|
103 |
params = TranscriptionPipelineParams.from_list(list(pipeline_params))
|
104 |
bgm_params, vad_params, whisper_params, diarization_params = params.bgm_separation, params.vad, params.whisper, params.diarization
|
105 |
|
|
|
|
|
|
|
|
|
|
|
106 |
if whisper_params.lang is None:
|
107 |
pass
|
108 |
elif whisper_params.lang == AUTOMATIC_DETECTION:
|
|
|
171 |
device=diarization_params.device
|
172 |
)
|
173 |
elapsed_time += elapsed_time_diarization
|
174 |
+
|
175 |
+
self.cache_parameters(
|
176 |
+
params=params,
|
177 |
+
add_timestamp=add_timestamp
|
178 |
+
)
|
179 |
return result, elapsed_time
|
180 |
|
181 |
def transcribe_file(self,
|
|
|
521 |
add_timestamp: bool
|
522 |
):
|
523 |
"""cache parameters to the yaml file"""
|
524 |
+
|
525 |
cached_params = load_yaml(DEFAULT_PARAMETERS_CONFIG_PATH)
|
526 |
param_to_cache = params.to_dict()
|
527 |
|
528 |
+
print(param_to_cache)
|
529 |
+
|
530 |
cached_yaml = {**cached_params, **param_to_cache}
|
531 |
cached_yaml["whisper"]["add_timestamp"] = add_timestamp
|
532 |
|
533 |
+
if cached_yaml["whisper"].get("lang", None) is None:
|
534 |
+
cached_yaml["whisper"]["lang"] = AUTOMATIC_DETECTION
|
535 |
+
|
536 |
save_yaml(cached_yaml, DEFAULT_PARAMETERS_CONFIG_PATH)
|
537 |
|
538 |
@staticmethod
|