Merge branch 'multi_language_transcript' into for_webui

This commit is contained in:
misyaguziya
2024-12-19 15:21:14 +09:00

View File

@@ -58,12 +58,16 @@ class AudioTranscriber:
case "Google": case "Google":
confidences = [] confidences = []
for language, country in zip(languages, countries): for language, country in zip(languages, countries):
try:
text, confidence = self.audio_recognizer.recognize_google( text, confidence = self.audio_recognizer.recognize_google(
audio_data, audio_data,
language=transcription_lang[language][country][self.transcription_engine], language=transcription_lang[language][country][self.transcription_engine],
with_confidence=True with_confidence=True
) )
confidences.append({"confidence": confidence, "text": text, "language": language}) confidences.append({"confidence": confidence, "text": text, "language": language})
except Exception:
pass
result = max(confidences, key=lambda x: x["confidence"]) result = max(confidences, key=lambda x: x["confidence"])
case "Whisper": case "Whisper":