Added a nice Avatar for Jade
Updated the main.py with the help of ChatGPT to make sure Jade doesn't run forever while still allowing for her to run forever Included a requirements.txt to allow me to install again if need be.
This commit is contained in:
parent
473da1b4ec
commit
16217d1405
BIN
Jade_Avatar.png
Normal file
BIN
Jade_Avatar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 MiB |
46
main.py
46
main.py
@ -9,25 +9,39 @@ wake_word = "Jade"
|
||||
def recognize_speech():
|
||||
r = sr.Recognizer()
|
||||
with sr.Microphone() as source:
|
||||
print("Say something!")
|
||||
audio = r.listen(source)
|
||||
try:
|
||||
text = r.recognize_sphinx(audio)
|
||||
print(f"You said: {text}")
|
||||
if wake_word.lower() in text.lower():
|
||||
# Get the intent from the text
|
||||
intent = get_intent(text)
|
||||
response = handle_intent(intent)
|
||||
say(response)
|
||||
except sr.UnknownValueError:
|
||||
print("PocketSphinx could not understand audio")
|
||||
except sr.RequestError as e:
|
||||
print(f"PocketSphinx error; {e}")
|
||||
|
||||
while True:
|
||||
print("Say something!")
|
||||
audio = r.listen(source)
|
||||
try:
|
||||
text = r.recognize_sphinx(audio)
|
||||
print(f"You said: {text}")
|
||||
if wake_word.lower() in text.lower():
|
||||
# Listen for a specific command
|
||||
say("What can I do for you?")
|
||||
command_audio = r.listen(source)
|
||||
command_text = r.recognize_sphinx(command_audio)
|
||||
print(f"You said: {command_text}")
|
||||
# Check if user wants to exit during command
|
||||
if "stop" in command_text.lower() or "exit" in command_text.lower():
|
||||
say("Goodbye!")
|
||||
break
|
||||
# Get the intent from the command text
|
||||
intent = get_intent(command_text)
|
||||
response = handle_intent(intent)
|
||||
say(response)
|
||||
# Check if user wants to exit after command
|
||||
if "stop" in response.lower() or "exit" in response.lower():
|
||||
say("Goodbye!")
|
||||
break
|
||||
except sr.UnknownValueError:
|
||||
print("PocketSphinx could not understand audio")
|
||||
except sr.RequestError as e:
|
||||
print(f"PocketSphinx error; {e}")
|
||||
|
||||
# Define the function to get the intent from text
|
||||
def get_intent(text):
|
||||
# TODO: implement intent recognition
|
||||
return "greeting"
|
||||
|
||||
# Call the speech recognition function
|
||||
recognize_speech()
|
||||
recognize_speech()
|
47
requirements.txt
Normal file
47
requirements.txt
Normal file
@ -0,0 +1,47 @@
|
||||
boto3==1.26.132
|
||||
botocore==1.29.132
|
||||
certifi==2023.5.7
|
||||
cffi==1.15.1
|
||||
charset-normalizer==3.1.0
|
||||
colorama==0.4.6
|
||||
einops==0.6.1
|
||||
encodec==0.1.1
|
||||
filelock==3.12.0
|
||||
fsspec==2023.5.0
|
||||
funcy==2.0
|
||||
huggingface-hub==0.14.1
|
||||
idna==3.4
|
||||
Jinja2==3.1.2
|
||||
jmespath==1.0.1
|
||||
MarkupSafe==2.1.2
|
||||
mpmath==1.3.0
|
||||
mypy==1.3.0
|
||||
mypy-extensions==1.0.0
|
||||
networkx==3.1
|
||||
numpy==1.24.3
|
||||
packaging==23.1
|
||||
Pillow==9.3.0
|
||||
pocketsphinx==5.0.0
|
||||
PyAudio==0.2.13
|
||||
pycparser==2.21
|
||||
python-dateutil==2.8.2
|
||||
PyYAML==6.0
|
||||
regex==2023.5.5
|
||||
requests==2.30.0
|
||||
s3transfer==0.6.1
|
||||
scipy==1.10.1
|
||||
six==1.16.0
|
||||
sounddevice==0.4.6
|
||||
soundfile==0.12.1
|
||||
SpeechRecognition==3.10.0
|
||||
suno-bark @ git+https://github.com/suno-ai/bark.git@1ad007171e0c46078eb6d3afb6db4daf0c4f41cd
|
||||
sympy==1.12
|
||||
tokenizers==0.13.3
|
||||
tomli==2.0.1
|
||||
torch==2.0.1+cu117
|
||||
torchaudio==2.0.2+cu117
|
||||
torchvision==0.15.2+cu117
|
||||
tqdm==4.65.0
|
||||
transformers==4.29.0
|
||||
typing_extensions==4.5.0
|
||||
urllib3==1.26.15
|
Loading…
x
Reference in New Issue
Block a user