From 1b701e94cf813caef65d09931b51b3e9242a7626 Mon Sep 17 00:00:00 2001 From: Gabe <64803229+GabeDR@users.noreply.github.com> Date: Sat, 22 Mar 2025 19:41:25 -0400 Subject: [PATCH 1/2] Fix ModuleNotFoundError for RealtimeSTT --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/GabeDR/Jarvis?shareId=XXXX-XXXX-XXXX-XXXX). --- README.md | 2 +- RealtimeSTT.py | 25 +++++++++++++++++++++++++ requirements.txt | 1 + 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 RealtimeSTT.py diff --git a/README.md b/README.md index dbf7dcf..1d2430c 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ ollama library ## Installation Ensure Python and the necessary libraries are installed: ``` -pip install openai speechrecognition torch ollama +pip install openai speechrecognition torch ollama RealtimeSTT ``` Go to https://platform.openai.com/assistants to set up your assistant to get diff --git a/RealtimeSTT.py b/RealtimeSTT.py new file mode 100644 index 0000000..a61e40f --- /dev/null +++ b/RealtimeSTT.py @@ -0,0 +1,25 @@ +import speech_recognition as sr + +class AudioToTextRecorder: + def __init__(self, spinner=False, model="tiny.en", language="en", post_speech_silence_duration=0.1, silero_sensitivity=0.4): + self.recognizer = sr.Recognizer() + self.microphone = sr.Microphone() + self.spinner = spinner + self.model = model + self.language = language + self.post_speech_silence_duration = post_speech_silence_duration + self.silero_sensitivity = silero_sensitivity + + def text(self): + with self.microphone as source: + self.recognizer.adjust_for_ambient_noise(source) + print("Listening...") + audio = self.recognizer.listen(source) + try: + print("Recognizing...") + text = self.recognizer.recognize_google(audio, language=self.language) + return text + except sr.UnknownValueError: + return "Could not understand audio" + except sr.RequestError as e: + return f"Could not request results; {e}" diff --git a/requirements.txt b/requirements.txt index 976837a..526b2ee 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,3 +5,4 @@ torch git+https://github.com/openai/whisper.git transformers pygame +RealtimeSTT From f3abeea0b6f39598ade187d1f5eb9c9d46b9c5e4 Mon Sep 17 00:00:00 2001 From: Gabe <64803229+GabeDR@users.noreply.github.com> Date: Sat, 22 Mar 2025 19:46:41 -0400 Subject: [PATCH 2/2] --- README.md | 2 +- requirements.txt | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1d2430c..d4055bf 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ ollama library ## Installation Ensure Python and the necessary libraries are installed: ``` -pip install openai speechrecognition torch ollama RealtimeSTT +pip install openai speechrecognition torch ollama RealtimeSTT python_weather icrawler spotipy ``` Go to https://platform.openai.com/assistants to set up your assistant to get diff --git a/requirements.txt b/requirements.txt index 526b2ee..bc82f7c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,3 +6,7 @@ git+https://github.com/openai/whisper.git transformers pygame RealtimeSTT +openai +python_weather +icrawler +spotipy