How To Make a GPT-3 Voice Chatbot in Python
Вставка
- Опубліковано 3 чер 2022
- In this video i show how to make a voice chatbot using gpt 3. It's really good at holding conversations and even understands context in the conversation. If you found this video useful, do subscribe! Thanks for watching
Code: github.com/Josode/GPT3VoiceBot
Get your open AI API key: beta.openai.com/account/api-keys
Open AI Playground: beta.openai.com/playground
Song: Everen Maxwell - A Day at Sea
Music provided by NoCopyrightSounds
Free Download/Stream:
Watch: youtu.be/
Song: OBLVYN x RIELL - With You [NCS Release]
Music provided by NoCopyrightSounds
Free Download/Stream: NCS.io/ORWithYou
Watch: • OBLVYN x RIELL - With ...
Song: Fiko - Waiting For You [NCS Release]
Music provided by NoCopyrightSounds
Free Download/Stream: NCS.io/WaitingForYou
Watch: • Fiko - Waiting For You...
Song: Jay Eskar & Doxed - Let's Run Away (feat. Rico 56) [NCS Release]
Music provided by NoCopyrightSounds
Free Download/Stream: NCS.io/LetsRunAway
Watch: • Jay Eskar & Doxed - Le... - Ігри
This also works for the new one! props to you!
Great video sir. I was running into some problems with libraries. Thanks for the explanation.
I’m here and I am listening! You never know who sees these. UA-cam put this video on my feed! I needed something like this. I almost always run into library issues or compatibility issues and then have to abandon tutorials altogether after working on them for what takes me a lot of times hours. Thank you for making this. I’m going to give it a shot. I believe ai can help with the longevity of man. So I’m determined to find something that I can work with with my very limited resources. Free tutorials like these really help me learn. 🙏
Thanks for the comment and support:D
bro how to add a option to do conversation in another language and also how can i change the voice of the output pls bro tell a solution for both
Awesome bro. I got it working but there are heavy delay's is that just from crappy internet?
I have 2 problems whit ai api key, i have copyed the api key in the file "sk is not definited" ad in api key same error, anyone can help me?
Hey. Be cool to see this with Whisper. Neat stuff bud! Would love to chat about a project been thinking of if you have the time.
why its taking so long duration to reply back after listening?
it keeps showing "listening....please speak clearly "
and doesn't executes the second reply further after first reply...
Great video ✌️👽 I am trying to learn the python basics to make a gpt-3 chat bot idea i have
Great video man! I was wondering if i can write in the code some preset messages that i want the bot to always remember before we start to talk.
Thanks man.
Thanks! If you want some preset messages you can add them to the "conversation" string if that makes sense. Hope this helps
Nice! Thanks for video! Can you tell me if you know any python lib to make the voice with a natural voice timbre?
Not that I know of
hello, i have followed the steps but there is no response from the bot, terminal keep showing "listening... speak clearly into mic.". i have tried changing the engine to text-davinci-002 but still no progress. a help will be appreciated please
Have you double checked the microphone index? It could be that you're using the wrong microphone
@@Josode when i ran the code for first time, it asked for the microphone permission which i granted And double checked again in the settings as well
what do we define api=key??
it's not working in mine
What if a GPT-3 virtual assistant could access your computer by opening apps, documents or games? Or definitely telling it to do a task, and it controls your computer by moving the cursor and typing on the keyboard on its own. If so, how can I do that?
I need it so I'll work more efficiently and complete quickly my tasks.
Thanks for your content, I really love it 💙
You can include python libraries for it, I've done it myself but it was rather boring because I had prewritten the answers to any question in my previous assistant, hopefully I can make this work now so I can actually have fun now. If you've got any questions on how to do that, feel free to ask.
how do you get the API_KEY, i try to import in, it turn into an error and even if i pip install it, it dosent seem to find it
be sure that they are under the same folder and be sure that your api key is defined as string between "your api key here"
Anyone know how to implement a translator in the code for the output text?
Also, how to I add a wake word to it?
Hello how are you doing? I love your videos, where can I get the complete code or the tutorial? Since it is not on github
Github link is in the description!
How do I implement a custom voice model to the ai so that it will give responses in that voice?
voice = engine.getProperty('voices')
engine.setProperty('voice', voice[1].id)
add this to your code
Hello, and thank you for making this video. I followed the steps successfully all the way through, but for some reason, the bot can listen to me but I am not getting any response from it. All I get is 'listening...' and 'no longer listening' but no text nor audio from the bot. Any idea how to fix this? Thanks again!
Never mind. It's fixed, but, I still have a couple of questions: 1. How can I change the voice? (I want it to be a female) By obtaining an API from Google perhaps? 2. How can I train this bot using my own dataset?
Unfortunately I couldn't get a female voice to work with pyttsx3. There might be a way to use a female Google tts but it would probably cost money to use. As for training it on your own dataset I'm not sure how you could do that. What you can do is change the name of the bot. For example you could make the name Obama instead of "Bot" and it will speak like Obama. Hope this helps 🙏
edit: it turns out you can get a female voice with pyttsx 3! after engine = pyttsx3.init() on line 10 write
voice = engine.getProperty('voices')
and on line 11 write
engine.setProperty('voice', voice[1].id)
@@Josode Thanks. I have already managed to change the voice. As for the training, I read that it can be done by running a command with the file you want to use. That's according to OpenAI's site. 'Haven't tried it to see how easy that is. Anyways, keep the videos coming. You're doing a great job.
@@McLarenIT1 thanks!
@Ryan Y. Hey, I am facing the same problem (no text or audio from the bot)? How did you fix it? Thanks in advance!
Is it as same as chat gpt ?
this does not work as just comes up with TypeError: listen() missing 1 required positional argument: 'source'
For some reason, my chatbot GPT doesn't talk back to me
Am I able to add this to a raspberry pi?
No module named 'api_secrets'. Please Solve the problem
Lol just ask gpt3
Great code! Works well and i even changed the voice! Having one problem tho, after 3 replies it stucks on 'listening...' and doesnt do anything after that anymore. Hope that a friendly internet ghost can help me! :)
Hey,
I didn't modify the voice as yet but I am having the same 'stuck on "listening..."' after 1 or 2 tries.
Did you find a solution?
By the way, great working code @Josode!
@@FarnazBaksh I haven't unfortunately. Having a new go soon by using ChatGPT to code it for me 😂
@@JohnSmith-ts2od From ChatGPT:
If the code is stuck on "listening...", it's possible that the microphone is not being properly recognized by the system. Here are a few things you can try to resolve the issue:
1. Make sure that the microphone is properly connected to your computer and that it is turned on.
2. Check the device index of your microphone in the sr.Microphone(device_index=1) line. You can try setting the device index to a different value (e.g., 0) if the current index is not correct.
3. Check that the microphone is not being used by another application or process. If it is, close the other application or process and try again.
4. Restart your computer to make sure that any conflicting processes are terminated.
5. If none of the above solutions work, try using a different microphone or testing your current microphone with a different application to make sure that it is working properly.
To print out a message when the code is stuck on "listening...", you can add a timeout parameter to the r.listen() method and check if an exception is raised due to the timeout.
while True:
with mic as source:
print("
listening...")
r.adjust_for_ambient_noise(source, duration=0.1) #background noise
try:
audio = r.listen(source, timeout=5) # set timeout to 5 seconds
except sr.WaitTimeoutError:
print("Microphone is not picking up any sound. Please check your microphone and try again.")
continue
print("no longer listening.
")
If the code is still stuck at "listening..." after one attempt of running, it could be due to several reasons. Here are a few things you can try:
1. Check if your microphone is working properly. You can try using a different microphone to see if that resolves the issue.
2. Make sure the correct microphone is selected in the code. You can try changing the device_index value to a different number or removing the device_index argument altogether to use the default microphone.
3. Check if any other applications on your system are using the microphone. Close those applications or try restarting your computer.
4. Check if the speech_recognition library is installed correctly. You can try reinstalling it using pip.
5. Try increasing the value of the duration parameter in the adjust_for_ambient_noise() method to make sure the microphone is picking up your voice properly.
Is there a way to modify the voice so it's not so robotic?
I haven't found any good realistic voices that have a python api unfortunately 😕
@@Josode not sure if these two ideas can mix but take a look at this from CEB studio. A Blender artist / Developer
ua-cam.com/video/-wX1K-UsXcw/v-deo.html
@@Josode Did you try ELEVENLABS
Wonderful video, can you help, igot an error asking me to install pyaudio, but I also get am error while downloading pyaudio
i would try installing pyaudio via pipwin.
pip install pipwin
pipwin install pyaudio
@@Josode thanks for replying but does the pipwin command work on a mac because I tried that and it gave an error
@@priskay5458 for me worked "py -m pip install pipwin" anyway iam on windows so mby it doesnt help
@@martindanko2194 thank you
THANK YOU SO MUCH. Is there a way to have the voice in spanish/latin accent? Please
what am i supposed to do in that api_secrets
Set API_KEY = "[open ai api key]"
Ask it how many humans it can it talk to in 1 second.
I want to run this through an alexa
Amazing work! I would love to get this working, but when I try to run it, I get the error:
Traceback (most recent call last):
File "C:\Users\jacob\Desktop\GPT3VoiceBot-main\venv\lib\site-packages\speech_recognition\__init__.py", line 108, in get_pyaudio
import pyaudio
ModuleNotFoundError: No module named 'pyaudio'
When I try to install "pyaudio" I get an error message.
I have manually installed C++ on my computer...
Can you help me please? :-)
i would try installing pyaudio via pipwin.
pip install pipwin
pipwin install pyaudio
@@Josode I'll try that, thanks!
Hey Great video !!! , but i am getting this error can you help me with this
RateLimitError: You exceeded your current quota, please check your plan and billing details.
Thanks 😊 my guess is that your open ai api has run out of uses. You could try going to the open ai api website and creating a new account?
Mine can import from api_secret
Mine can't import I meant, I don't know how to import it
That's amazing! The puzzle pieces are available, ready to put them together. I also made a video about gpt-3, it's more about the overall practical side and a virtual girlfriend. Happy to see that somebody else is still making content about it. Not late from the 🚂
how to configure api secrets
Go to the link in the description and copy your api key. Create a python file and in it write API_KEY = "[paste api key here]". i put the code in the description too if that helps!
@@Josode thanks.
It doesnt work!!!😭