From 84c83cfd7080728336fb9b3217a9a4a32dda4301 Mon Sep 17 00:00:00 2001 From: retoor Date: Sat, 18 Jan 2025 09:19:21 +0100 Subject: [PATCH] Minor change. --- tts.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tts.py b/tts.py index edb4175..fffdaf6 100644 --- a/tts.py +++ b/tts.py @@ -37,17 +37,18 @@ async def main(): recognizer = sr.Recognizer() with sr.Microphone() as source: - print("Adjusting for ambient noise, please wait...") - recognizer.adjust_for_ambient_noise(source, duration=1) - print("Listening...") + print("Adjusting to surroundings for a five seconds.") + recognizer.adjust_for_ambient_noise(source, duration=5) + while True: + print("Listening...") try: audio_data = recognizer.listen(source, timeout=10) - text = recognizer.recognize_google(audio_data, language="en-US") - print(f"Recognized Text: {text}") + text = recognizer.recognize_google(audio_data, language="nl-NL") #en-US + print(f"You said:\n\t{text}") response_llm = molodetz.gpt4o_mini(text) - print(f"Response from gpt4o_mini: {response_llm}") + print(f"GPT4o mini said:\n\t{response_llm}") await gcloud.tts(response_llm) except sr.WaitTimeoutError: continue @@ -58,4 +59,4 @@ async def main(): if __name__ == "__main__": import asyncio - asyncio.run(main()) \ No newline at end of file + asyncio.run(main())