added variable to store params for possible reload

This commit is contained in:
Jaikinator
2023-11-10 15:23:50 +01:00
parent f2877d7ad4
commit ea03bf1f06
+14
View File
@@ -75,6 +75,11 @@ class Scraibe:
Path to pyannote diarization model or model itself. Path to pyannote diarization model or model itself.
**kwargs: Additional keyword arguments for whisper **kwargs: Additional keyword arguments for whisper
and pyannote diarization models. and pyannote diarization models.
e.g.:
- verbose: If True, the class will print additional information.
- save_kwargs: If True, the keyword arguments will be saved
for autotranscribe. So you can unload the class and reload it again.
""" """
@@ -98,6 +103,15 @@ class Scraibe:
else: else:
self.verbose = False self.verbose = False
# Save kwargs for autotranscribe if you want to unload the class and load it again.
if kwargs.get('save_setup'):
self.params = dict(whisper_model = whisper_model,
dia_model = dia_model,
**kwargs)
else:
self.params = {}
def autotranscribe(self, audio_file : Union[str, torch.Tensor, ndarray], def autotranscribe(self, audio_file : Union[str, torch.Tensor, ndarray],
remove_original : bool = False, remove_original : bool = False,
**kwargs) -> Transcript: **kwargs) -> Transcript: