fix: cpu usage issue

This commit is contained in:
makaveli10
2024-02-28 13:55:37 +05:30
parent ec1349360a
commit 18b6168807
2 changed files with 14 additions and 4 deletions
+4 -1
View File
@@ -180,7 +180,7 @@ class WhisperModel:
return config
def transcribe(
def transcribe( # noqa: C901
self,
audio: Union[str, BinaryIO, np.ndarray],
language: Optional[str] = None,
@@ -315,6 +315,9 @@ class WhisperModel:
else:
speech_chunks = None
if audio.shape[0] == 0:
return None, None
features = self.feature_extractor(audio)
encoder_output = None