Omg exactly what I was looking for. I am 14 years old, I already have some experience with python, since I have been studying it alone for more that 1 year and I am fascinated by AI. I want to recreate Gideon from The Flash and maybe in the future create one of the largest tech companies
Will make sure to watch this when im not too busy! Still a begginer in python, but I'm really interested in this concept, plus it should help me feel more comfortable overall. Thanks in advance!
This is intriguing the thought of creating my own AI always make me feel amazed. From my knowledge in python coupled with this tutorial I hope I can create an Ai that can reprogram itself under certain circumstances
File "c:\Users\Dell\Desktop\My AI.py", line 3, in import speech_recognition as sr ModuleNotFoundError: No module named 'speech_recognition' How do i fix this?
Relatively new to coding so all these advanced concepts seem kinda new to me, I understand the basics like functions, parameters, for loops, while loops etc, what would you recommend for all the topics I should study on before I can fully grasp the concepts within this video?
This is great! Thank you!! How would you go about getting a TTS that sounds ... slightly less robotic? Furthermore!! Is there a way to make it only listen after a certain decibel level?
There are many APIs with better sounding voices but you likely have to pay for access. Try out Azure ($200 free credit) azure.microsoft.com/en-us/products/cognitive-services/text-to-speech/#features You can adjust for ambient noise with in-built methods. See this simple example: github.com/Uberi/speech_recognition/blob/master/examples/calibrate_energy_threshold.py Or the Troubleshooting section here: github.com/Uberi/speech_recognition#readme
Hey Mikael, love the video, just copied the code but for some reason it doesn't execute any of the commands. Like when I say, "Jarvis, go to google" (because I made the activation word Jarvis instead of computer), it catches what I said and writes it in the terminal, but doesn't execute. I could use some help.
We can try and debug this in the discord channel discord.gg/tCtNzKMG but as a first step it's a good idea to step through the code in debug mode if you are using VS Code for example.
Hi Mikael, this looks great! I'll try this out for myself for sure. I was wondering if you had a Github repo we can clone from? Also, are you planning on extending this assistant by any chance? I have quite a lot of ideas to add but not so sure about how to do it as efficiently as possible. Thx!
Wow this is honestly amazing. The video was straight forward and had no issues throughout the whole tutorial. One question though where do the notes get saved to? I cant seem to find where the notes are being saved on my computer if they are at all.
Thanks! By default they should just get saved in the current working directory of the project, so where the main.py file is. You could check the working directory path by running os.getcwd(). And of course you can specify the output folder directly. You can add the path to the line with something like "open([output_directory_here] + 'note_%s.txt' % now, 'w') as newFile:"
Hi, how would i go about adding a way for it to stop while reading from wiki? so if it were in the middle of reading i would say stop or somethin and it would end the reading and continue the loop. thank you
i keep getting the error 'function' object has no attribute 'getProperty' voices = engine.getProperty('voices'). Although i haven't finished the code, ive been just debugging it along the way and keep hitting this error. Please advise, and thank you!
i copied your code into my pycharm yet it isnt working, i dont know why? i even tried to change the speech commands but the only thing its not understanding anything i say
Thanks for the amazing tutorial! It really soothed my nerves seeing you build a project like this in relativly simple terms, question though if it's not a bother. If I would like to train my own voice for something like this, instead of using the built in one, where would you advice me to start and what are the overall steps involved? Again thanks for your amazing video and time!
That's a good question! You could take a look at Bark and a fork of that code with voice cloning as a starting point: github.com/serp-ai/bark-with-voice-clone. There's an increasing amount of nice voice cloning repositories out there from what I can tell. I'd love to find the time to make a little video about how to do it easily.
hey, my voice assistant isn't speaking back to me when i say 'Hello computer', i have copied your code word for word and it's not working. Does anyone have an idea why? Have a good day
If possible, could someone tell me the type of API required for Wolfram Alpha, I have multiple options and I am unsure as to which one was used in the video
Don't know mate. Looks like this vid was put together before Wolfram updated the development portal, which now insists that you specify an API for use with your app. I tried "Full Results API" and it didn't work. I've now sent Wolfram an email asking them if any of their APIs will work with python hobby projects designed using the 2022 Non commercial app. If you want you can try one of the following, which was also recommended for use with AI Assistants "Spoken Results API", "Fast query Recognizer API", "Summary Boxes API", "Conversational API".
I'll try another API with the code tomorrow (if I haven't head back from Wolfram) and keep you posted on here. Would save a lot of time if you did the same and sent them an email
I actually did find out just a few days ago, I foudnt that the only API working for me is the Spoken API, While it mostly works with numerical results, answers like age, or distance, or maths, it has worked fairly well, and I have found it to be functional enough. Hope it helped@@Doc959
Thank you so much for this tutorial! This is a good start for me on my project! I'm working on a personal assistant for any platform! Currently named Roko based on a cartoon called Rocko's Modern Life (I suck at naming shit so I just improvise, the name can change). Is there any forum or website I can dig deeper into learning about AI programming?
Hey Mikael, when I tried to install pyaudio folder, its says: PyAudio-0.2.11-cp39-cp39-win_amd64.whl is not a supported wheel on this platform. I'm using MacOS maybe that's why? I'm beginner so I can't solve this problem
Have you tried *brew install portaudio* before running pip install pyaudio to make sure that the prerequisite library is installed? See here if it helps: pypi.org/project/PyAudio/
@@mikaelcodes it says it can’t find the module and I should the installation. I’ve tried linking it to the portaudio file directory and making a .distutils file but it still does not work
Hey! I appreciate this video so much. My only question is if it would be better to put the 'hello' abilities in "else" of others so that if the query is about the origin of hello the AI knows what to do. But if this does not matter I'd love to hear your advice on it.
Amazing video, one question though. Is there a way to get it to listen out for a specified word. I want to give it a name like Siri or Alexa for the action command so I've settled on Aida (Artificially intellgent Desktop Assistant), but the problem is it keeps recognizing the speech either as the wrong name like 'Jada' or with the wrong spelling like 'Ada' or 'Ayda' so the command won't execute because the spelling doesn't match the activation word
The quick fix is to play along and have the keyword match against a list of those misspellings, for example: activation_words = ['jada', 'ada', 'ayda'] and then check against the whole list with something like if query[0] in activation_words. A longer route would be to train your custom speech-to-text recognition model...
A bit hard to say without seeing the code exactly. If you go through the code in debug mode step by step, does something go wrong when it's parsing the query? It's expecting you to start with the custom command and then follow with the action, so do make sure the structure of the command matches what it expects, or remove the need to use a special command word in the first place.
home control would be weird. I dont mind Alexa cause she is predictable, she wants to make a sale, right now i am building a tool like this for working with google sheets all day and analyzing data. I'm going to train it to listen and record in its own sheets its structure of how it makes good decisions on terms, placements, etc. Looking forward to using it.
im a 13 years old kid from iraq i thought that AI will be revolutionary and maybe be our future soo why not be one of the firsts to adapt AI as a career and use it for good since it will be a big success
i cant do pip install .\PyAudio-0.2.11-cp311-cp311-win_amd64.whl it says ERROR: PyAudio-0.2.11-cp311-cp311-win_amd64.whl is not a supported wheel on this platform. can someone help??
bro when i test it after the initial setup it shows something like winerror 193 in " engine - pyttsx3.init() " how to fix?? and it says ENGINE is not defined
Yes, that should be well within the realm of possibility. You could convert the pdf to text with PyPDF2 and then do a search against the question and return the surrounding text or the page number. For example python.plainenglish.io/searching-for-text-in-those-annoying-pdfs-d95b6dc7a055 should help.
Hey so I was working on this code a couple days ago and I have sat back down again but I ran into a problem. If I were to ask my assistant to say hello it will say hello but then wiki the word Hello and give me the origin of the word xD. Still kind of cool but floods the program so I have to shut down and restart to clear the program from reading the whole origin to the word Hello. I thought it could be possible that my code was set outside the {if query[0] == 'say':} line then it might continue the code therefore "accessing the personal data base" and wiki the word but I reviewed mine and yours and they look the same. The only difference is I added an {auto_suggest=False} in line 53 so it looks like 'wikiPage = wikipedia.page(searchResults[0], auto_suggest=False)' Thanks in advanced!
I was running into an error when asking wikipedia certain questions and it seemed to be auto suggesting different words. That fixed my one problem but I hope it hasn't caused this one. I have not been able to figure it out.
Hello! I like the tutorial a lot thanks for the tutorial, but right when i run the file and ask it to say hello, it only prints the input text and doesnt reply at all, is there a fix?
I have two coded AI, one works with quirky pre programmed random responses, but is slow in reaction, and keeps timing out after a min with no user response, so I have to activate it again manually. Also I lost the male voice. I have it installed on ms but pyttsx3 sapi5 won't let me use him. Now this leads me here to my new AI who is now a female. I can get it to respond with the say command, but not activationword first. When I say the word it comes back I did not catch that, please repeat. So I had to remove the key word, now the AI is always listening 😅 initially, I had the listener.listen line where you have it, but it wouldn't pick up the key word 'say' so I moved it to engine section. Now it hears key words in command, just not the name as activationword.
Great video. I immediately rebuilt it, everything works! Just one question: when I make a request to Wkipedia, the answers are sometimes very long. Is there a way to quit the answer with a exit keyword? Thanks.
Thanks, glad it all works for you! Great idea as well. A simple way to do this would be to add a KeyboardInterrupt in a Try/Except within the Speak method to allow you to interrupt any speech from the computer with the standard keyboard interrupt with Ctrl+C. This works with the Google speech-to-text, so try that. I pushed this update to the code, and here's the updated method specifically: pastebin.com/p8Sw2yjU. For the local pyttsx3 this doesn't seem to work as their callback method isn't working for newer versions of Python. It should be solvable with multithreading but that's a bit complex. Try the Google Cloud option first. I might look into alternatives for local text-to-speech later.
@@mikaelcodes Hi Mikael, Thanks for the quick reply. I also jokingly asked ChatGPT about this topic. ChatGPT suggested this solution (original code): I should write engine.say(text) engine.runAndWait() # Loop for user's voice input while True: # Record audio input with sr.Microphone() as source: audio = r.listen(source) try: # Convert audio to text speech_text = r.recognize_google(audio, language='de-DE') # Check if the user spoke the keyword "Ende". if 'End' in speech_text: engine.stop() break I think after updating the code that should be probably placed in def speak(text, rate=120): ... Right? Is this a solution for "voice termination"?
@@DemonicDentistCom ChatGPT is good for coding! And the speak method is the right place for it. So feel free to try it out. Maybe a while loop works fine and we don't need multiple threads :)
Hello everyone, I've been trying for a long time now to create a voice output that runs in its own thread and which was started in the main thread to stop using speech recognition in the main thread. I didn't succeed. It can't be because of my thread handling, I can stop a thread with keyword as long as that thread is not narrating. Stopping speech output via voice input probably doesn't work. Maybe it is on pyttsx3's runAndWait(), which just runs through the speech output. I'll try to ask the user the question after e.g. 50 words whether he wants to continue listening or not. If anyone has any advice, please...@@mikaelcodes
Hi can i add an image or like some kind of animation just like clippy we used to have back in the days. I wanna give the bot some animated stuff to do. Like when it rest it pop's up a chair and sits type of stuff.
Help please in Initial Setup! Exception has occurred: ModuleNotFoundError No module named 'distutils' File "C:\Users\dhurwitz\IdeaProjects\Voice AI Assistant\main.py", line 25, in parseCommand with sr.Microphone() as source: ^^^^^^^^^^^^^^^ File "C:\Users\dhurwitz\IdeaProjects\Voice AI Assistant\main.py", line 47, in query = parseCommand().lower().split() ^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'distutils'
If we add remember function in AI assistant and say something to remember. If we off or exit assistant, again when we run it and ask what you have remember. It is possible? AI assistant can remember things for a long time if we exit or run again?
Thank you kindly! That suggests to me that the line indentation might be wrong and the return command is located in a place the interpreter doesn't expect.
Hey so I have been trying to do this, but for some reason the bot does not seem to hear me. I tried Visual Studio Code and typed it out myself, and then I put the pastebin in visual studio 2019 to see if it would work and I can't get a response either way.
Sorry for the delay. What errors are you getting? Have you run any debugging on the microphone? You could jump on Discord and share more details if you're still working on this discord.gg/MWEeJDX4
hey i having at this for hours and i am not able to figure it out. there is no error in the whole code but when i run it it does not speak or print listening for a command. i am so confused please help me.
That's a tricky one without more info! Let's break it down into bits. Are you able to get any speech audio to come out? Try that first. Try adding some print messages in the code to see if they print, or step through the code in debug mode slowly to see if there are any issues in the code flow.
Yes, certainly. Pass the relevant language code to the speech recognition config as the parameter languageCode, for example es-ES cloud.google.com/speech-to-text/docs/speech-to-text-supported-languages
How can I leave all the speech and audio stuff and only have a text chat with the AI ? By just eliminating the Speech engine initialization ( 9-13 + listener = sr.Recognizer() ) ? Just wanna be sure
That's almost a different project entirely... however it's not hard to get a text chat going. You can just use this code: pastebin.com/waCNauPm I also created a branch in the repo just for text chat github.com/Mikael-Codes/ai-assistant/tree/onlytext. Note that it doesn't remember context unless you yourself pass it all the previous messages.
cool tut, it didnt seem to happen to you but my error reads "no module named 'date' not sure what to do, im still super new to coding and all, i tried "pip install data" and that installed sOmething but im still getting the error code it lists me having 5 problems: Import "date" could not be resolved Pylance(reportMissingImports) [Ln 1, Col 6] Import "speech_recognition" could not be resolved Pylance(reportMissingImports) [Ln 2, Col 8] Import "pyttsx3" could not be resolved Pylance(reportMissingImports) [Ln 3, Col 8] Import "wikipedia" could not be resolved Pylance(reportMissingImports) [Ln 5, Col 8] Import "wolframalpha" could not be resolved Pylance(reportMissingImports) [Ln 6, Col 8] i pip installed all of them in the terminal and it all repeated back to me what it did for you, not sure if its something with my computer or a file i dont have plugged in but someone pls help😭
I got rid of them warnings by clicking the 'manage packages for this environment button' none were installed for python 3.9 so I changed it to 3.12 (not sure why there's 2) but it showed all the packages for the 3.12 enviroment so I saved the project closed visual studio and opened again..and the date should be ' from datetime import datetime
Hello, I already did the recognitiopn for chrome but it doesn't open, could you help me please, it recognize in the text and it hears well but doesn't open chrome
Any time I try to run it I get an error code. ModuleNotFoundError: No module named 'speech_recognition' I followed what you did and made sure every single thing was done exactly how you did it... Not sure what's going on here.
What does it say when you run 'pip install SpeechRecognition' in the terminal? Note that it's not 'speech_recognition' when installing but that's how you import the module nonetheless.
am i able to use raspberry pie for this because every time i do it says that there is no module named speech_recognition wikipedia and a few of the other ones
Raspberry Pi should be powerful enough to run this, but you do need to install the dependencies by using pip install speechrecognition, pip install wikipedia, etc
i have actually a problem with your code the output is "list index out of range" the error is on the first line after (#list of commands), how can i fix this?
Sounds like there's a list being accessed in the code but at that point it doesn't have as many elements in it as it expects. Is it recognizing your voice properly?
when I try to install speech recognition it says "The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again." how do I fix this
You definitely want to make sure pip (Package installer for Python) is properly installed. This guide can help: builtin.com/software-engineering-perspectives/pip-command-not-found
is there a way to do the pip stuff easier or a way to explain this more/// ( that would be great ) thanks for making this viedo i made sure to like and support you thanks and have a good time
You can use PyCharm instead of VS Code which has a package manager in it for easier management of dependencies. Pip can be a pain but learning it for this project will help you with many other Python projects too.
hello, i came across your video while looking for an answer to my question, still cant figure. i get the error: import speech_recognition as sr ModuleNotFoundError: No module named 'speech_recognition' and i tried pip installing but i cant get it running even if i have the source code. pls help
Hey. Which version of Python are you using? What happens exactly when you run 'pip install speechrecognition'? I tried in Linux Mint by creating a virtual environment for my Python 3.11.1 installation and it worked fine just now. Does your pip work when installing other packages? You can try 'python -m pip install --upgrade pip' before running pip install.
@@mikaelcodes hey' it was in fact 3.11. i figured it out after opening the interpreter in settings and somehow just click on pip to select and reinstall. or something. im kinda using my hands to navigate in the dark at this point
thanks for the great video one problem i have written your same code but my ai doesn't respond to the commands like wikipedia or go to google can you help ?
Have you tried running pip install commands to bring in the packages? I'd recommend creating a virtual environment too. PyCharm is an IDE that handles these quite nicely.
hi, can anyone help me. i try this code but its not speak to me. Its only say " All system nominal" and then its listening for command and writing what i talking and not talking back about my question. What is the problem ?
Hey, i was having this problem for what i thought was no reason. I had a play around and changed my activation word from starting with a capital to all lower case and it worked, try that and see if it works. 👍
Hello Sir, whenever I run the command compute the distance between Hong Kong to Kuala Lumpur….. I’m getting an error message. Also, I notice listOrdict is not defined
You can find the definition for the method on row 62 pastebin.com/WPPtgiAn What error message are you getting? You could post it on Discord: discord.gg/PHzBvjC5
Thanks! You mean to keep opening the web page in the same tab? In that case you can try to update the code to webbrowser.get('chrome').open(query, new = 0). The new = 0 parameter should prevent a new window or tab from being opened as per the docs: docs.python.org/3/library/webbrowser.html
Hi there Mikael I'm new to the channel thanks for the video it's really cool and helpful but I have a little issue when I entered certain dependencies (Wolfram alpha,date and speech recongitnition) into my terminal to install them it gave me the message ERROR:could not find a version that satisfies the requirement wolframaphla (from version:none) and ERROR:No matching distribution found for wolframaphla. If you could help it would mean a lot thanks.