Skip to content

Commit

Permalink
fix:runtime_lang
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Jan 16, 2025
1 parent 61dcdd5 commit 88ca19d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions ovos_dinkum_listener/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def transcribe(self, audio: Optional[Union[bytes, AudioData]] = None,
audiod = audio
else:
raise ValueError(f"'audio' must be 'bytes' or 'AudioData', got '{type(audio)}'")
LOG.debug(f"Transcribing with lang: {lang}")
return self.engine.transcribe(audiod, lang)


Expand Down
5 changes: 3 additions & 2 deletions ovos_dinkum_listener/voice_loop/voice_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,7 @@ def _get_tx(self, stt_context: dict) -> (str, dict):
@return: string transcription and dict context
"""
# handle lang detection from speech
lang = self.stt.lang
if "stt_lang" in stt_context:
lang = self._validate_lang(stt_context["stt_lang"])
stt_context["stt_lang"] = lang
Expand All @@ -711,15 +712,15 @@ def _get_tx(self, stt_context: dict) -> (str, dict):

# get text and trigger callback
try:
utts = self.stt.transcribe() or []
utts = self.stt.transcribe(lang=lang) or []
except:
LOG.exception("STT failed")
utts = []

if not utts and self.fallback_stt is not None:
LOG.info("Attempting fallback STT plugin")
try:
utts = self.fallback_stt.transcribe() or []
utts = self.fallback_stt.transcribe(lang=lang) or []
except:
LOG.exception("Fallback STT failed")

Expand Down

0 comments on commit 88ca19d

Please sign in to comment.