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...
  • Ігри

КОМЕНТАРІ • 82

  • @alexsbrownjr
    @alexsbrownjr Рік тому +1

    This also works for the new one! props to you!

  • @TishyaMoulick
    @TishyaMoulick Рік тому

    Great video sir. I was running into some problems with libraries. Thanks for the explanation.

  • @suomynona7261
    @suomynona7261 Рік тому +4

    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. 🙏

    • @Josode
      @Josode  Рік тому +2

      Thanks for the comment and support:D

  • @glitchedcold
    @glitchedcold Рік тому +5

    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

  • @chessmusictheory4644
    @chessmusictheory4644 Рік тому

    Awesome bro. I got it working but there are heavy delay's is that just from crappy internet?

  • @invictvs_roleplay
    @invictvs_roleplay Рік тому +2

    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?

  • @thesystemera
    @thesystemera Рік тому

    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.

  • @mdhasanoorzaman6408
    @mdhasanoorzaman6408 Рік тому +1

    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...

  • @KingdomOfGnome
    @KingdomOfGnome Рік тому +2

    Great video ✌️👽 I am trying to learn the python basics to make a gpt-3 chat bot idea i have

  • @BrianBrahimllari
    @BrianBrahimllari Рік тому

    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.

    • @Josode
      @Josode  Рік тому

      Thanks! If you want some preset messages you can add them to the "conversation" string if that makes sense. Hope this helps

  • @frrabelo
    @frrabelo Рік тому

    Nice! Thanks for video! Can you tell me if you know any python lib to make the voice with a natural voice timbre?

    • @Josode
      @Josode  Рік тому

      Not that I know of

  • @bewithkhan
    @bewithkhan Рік тому

    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

    • @Josode
      @Josode  Рік тому

      Have you double checked the microphone index? It could be that you're using the wrong microphone

    • @bewithkhan
      @bewithkhan Рік тому

      @@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

  • @nischithkoundinya9142
    @nischithkoundinya9142 Рік тому

    what do we define api=key??
    it's not working in mine

  • @Eresse
    @Eresse Рік тому

    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 💙

    • @jdajcman
      @jdajcman Рік тому +1

      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.

  • @dastfa8402
    @dastfa8402 Рік тому

    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

    • @splashoui3760
      @splashoui3760 Рік тому

      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"

  • @Haru-pc1sm
    @Haru-pc1sm Рік тому

    Anyone know how to implement a translator in the code for the output text?

  • @F1dg3t
    @F1dg3t Рік тому

    Also, how to I add a wake word to it?

  • @humansoftware1214
    @humansoftware1214 Рік тому +1

    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

    • @Josode
      @Josode  Рік тому

      Github link is in the description!

  • @F1dg3t
    @F1dg3t Рік тому

    How do I implement a custom voice model to the ai so that it will give responses in that voice?

    • @maxdcreator
      @maxdcreator Рік тому

      voice = engine.getProperty('voices')
      engine.setProperty('voice', voice[1].id)

    • @maxdcreator
      @maxdcreator Рік тому

      add this to your code

  • @McLarenIT1
    @McLarenIT1 Рік тому

    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!

    • @McLarenIT1
      @McLarenIT1 Рік тому

      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?

    • @Josode
      @Josode  Рік тому +1

      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)

    • @McLarenIT1
      @McLarenIT1 Рік тому

      @@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.

    • @Josode
      @Josode  Рік тому

      @@McLarenIT1 thanks!

    • @RahulRaj-mo9ck
      @RahulRaj-mo9ck Рік тому

      @Ryan Y. Hey, I am facing the same problem (no text or audio from the bot)? How did you fix it? Thanks in advance!

  • @geskar
    @geskar Рік тому

    Is it as same as chat gpt ?

  • @alexh7140
    @alexh7140 Рік тому

    this does not work as just comes up with TypeError: listen() missing 1 required positional argument: 'source'

  • @obsidianrose316
    @obsidianrose316 9 місяців тому

    For some reason, my chatbot GPT doesn't talk back to me

  • @zacharyraddatz9930
    @zacharyraddatz9930 Рік тому

    Am I able to add this to a raspberry pi?

  • @SpotterTarget
    @SpotterTarget Рік тому +1

    No module named 'api_secrets'. Please Solve the problem

  • @JohnSmith-ts2od
    @JohnSmith-ts2od Рік тому

    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! :)

    • @FarnazBaksh
      @FarnazBaksh Рік тому +1

      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!

    • @JohnSmith-ts2od
      @JohnSmith-ts2od Рік тому +1

      @@FarnazBaksh I haven't unfortunately. Having a new go soon by using ChatGPT to code it for me 😂

    • @FarnazBaksh
      @FarnazBaksh Рік тому +1

      @@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.

    • @FarnazBaksh
      @FarnazBaksh Рік тому +1

      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.
      ")

    • @FarnazBaksh
      @FarnazBaksh Рік тому +1

      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.

  • @elidelia2653
    @elidelia2653 Рік тому

    Is there a way to modify the voice so it's not so robotic?

    • @Josode
      @Josode  Рік тому +1

      I haven't found any good realistic voices that have a python api unfortunately 😕

    • @elidelia2653
      @elidelia2653 Рік тому +1

      @@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

    • @hasa9503
      @hasa9503 Рік тому

      @@Josode Did you try ELEVENLABS

  • @priskay5458
    @priskay5458 Рік тому

    Wonderful video, can you help, igot an error asking me to install pyaudio, but I also get am error while downloading pyaudio

    • @Josode
      @Josode  Рік тому +1

      i would try installing pyaudio via pipwin.
      pip install pipwin
      pipwin install pyaudio

    • @priskay5458
      @priskay5458 Рік тому

      @@Josode thanks for replying but does the pipwin command work on a mac because I tried that and it gave an error

    • @martindanko2194
      @martindanko2194 Рік тому +1

      @@priskay5458 for me worked "py -m pip install pipwin" anyway iam on windows so mby it doesnt help

    • @priskay5458
      @priskay5458 Рік тому

      @@martindanko2194 thank you

  • @xlgabriel
    @xlgabriel Рік тому +1

    THANK YOU SO MUCH. Is there a way to have the voice in spanish/latin accent? Please

  • @flawlessreplayyt9517
    @flawlessreplayyt9517 Рік тому

    what am i supposed to do in that api_secrets

    • @Josode
      @Josode  Рік тому

      Set API_KEY = "[open ai api key]"

  • @eikodunn
    @eikodunn Рік тому

    Ask it how many humans it can it talk to in 1 second.

  • @natures_soundscapes
    @natures_soundscapes Рік тому

    I want to run this through an alexa

  • @eastwood451
    @eastwood451 Рік тому

    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? :-)

    • @Josode
      @Josode  Рік тому +5

      i would try installing pyaudio via pipwin.
      pip install pipwin
      pipwin install pyaudio

    • @eastwood451
      @eastwood451 Рік тому

      @@Josode I'll try that, thanks!

  • @basavarajharvi
    @basavarajharvi Рік тому

    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.

    • @Josode
      @Josode  Рік тому +1

      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?

  • @funnycompliment2877
    @funnycompliment2877 Рік тому

    Mine can import from api_secret

  • @TechMeMeIdeatoApp
    @TechMeMeIdeatoApp Рік тому +4

    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 🚂

  • @sknmusic1943
    @sknmusic1943 Рік тому

    how to configure api secrets

    • @Josode
      @Josode  Рік тому +3

      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!

    • @sknmusic1943
      @sknmusic1943 Рік тому

      @@Josode thanks.

  • @Ninjax133
    @Ninjax133 Рік тому

    It doesnt work!!!😭