tweaked Whisper parameters

This commit is contained in:
EliasVincent 2023-03-09 21:18:46 +01:00
parent d5efc0659b
commit a24fa781f1

View File

@ -11,11 +11,11 @@ def do_stt():
transcription = "" transcription = ""
r = sr.Recognizer() r = sr.Recognizer()
with sr.Microphone() as source: with sr.Microphone() as source:
r.adjust_for_ambient_noise(source) r.adjust_for_ambient_noise(source, 0.2)
audio = r.listen(source) audio = r.listen(source)
try: try:
transcription = r.recognize_whisper(audio, language="english", model="tiny.en") transcription = r.recognize_whisper(audio, language="english", model="base.en")
except sr.UnknownValueError: except sr.UnknownValueError:
print("Whisper could not understand audio") print("Whisper could not understand audio")
except sr.RequestError as e: except sr.RequestError as e: