Python Command Line Voice Chat with OpenAI ChatGPT
ChatGPT is a Python script that uses the OpenAI API that allows you to converse with chatgpt (OpenAI) using your voice This script can be used to create chatbots or conversational agents for a variety of purposes.
Welcome to ChatGPT on the command line used with API!
This project, "Python-Voice-Chat-with-ChatGPT-CLI" allows you to converse with chatgpt (OpenAI) using your voice, utilizes the OpenAI GPT-3 model and speech recognition to facilitate a chat interaction between users and a bot through voice input. By leveraging the microphone and computer capabilities, users can engage in conversations with the bot, with the dialogue history logged into a text file. The bot's responses are also audibly communicated using Pyttsx3.
Languages
OS
I'm Rangersmyth (internet name), and I'm currently learning Python and Bash coding.
This script uses the OpenAI GPT-3 model and speech recognition to generate a chat between the user and the bot using the microphone and computer to talk to each other. The conversation history is logged to a text file, and the bot's responses are spoken aloud using Pyttsx3.
This script uses the OpenAI GPT-3 model and speech recognition to generate a chat between the user and the bot using the microphone and computer to talk to each other. The conversation history is logged to a text file, and the bot's responses are spoken aloud using Pyttsx3.
- Clone or download this repository. This will work for all platforms.
- Install the required modules by running
pip install -r requirements.txt
. 💡 Just use the following module to install on either Windows or Linux. 💡 The module SpeechRecognition for Windows and speech_recognition is for Linux
💡 pip install PyAudio & pip install SpeechRecognition for Windows. - Make sure you have an OpenAI API key. If you don't have one, go to https://beta.openai.com/signup/ to sign up for early access and get an API key.
- In the script, replace "YOUR_API_KEY" with your API key.
- Run the script using
python gpt_voice_chat.py
. - A text file called gpt_voice.txt will be created once you have started the voice recognition script, this will save the conversation with timestamps.
Make sure you have an OpenAI API key. If you don't have one, go to https://beta.openai.com/signup/ to sign up for early access and get an API key.
- The script requires the following modules: If any problem is encountered install manually $ pip install or pip3 install modulename.
- speech_recognition is a Linux module and SpeechRecognition is for Windows.
pyttsx3
speech_recognition
openai
sounddevice
soundfile
SpeechRecognition
alive_progress
PyAduio
- Add error handling for cases where the mic or sound devices are not available.
- Implement a GUI to make the chat more user-friendly.
- Allow the user to choose which voice the bot should use.
- Improve the accuracy of speech recognition by using a custom language model.
- Add support for multiple languages.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.