This project is a voice-activated assistant using OpenAI's GPT-4. It records the user's voice, transcribes it, feeds it to the GPT-4 model, and plays back the response using text-to-speech. It also measures the time taken for each step in the process.
- Python 3.8+
- OpenAI API key
- Required Python packages:
PyQt5
,sounddevice
,numpy
,openai
,gTTS
,pydub
,scipy
-
Clone the repository:
git clone https://github.com/mh-nyris/openAI.git
-
Navigate into the project directory:
cd openAI
-
Install the necessary packages:
pip install -r requirements.txt
Note: It's recommended to do this in a virtual environment to avoid installing packages globally.
This project also depends on a few packages that need to be installed via Homebrew:
brew install ffmpeg
ffmpeg is required for pydub to work correctly.
-
Replace
"placeholder"
in the following lines of code with your own OpenAI API credentials:openai.organization = "placeholder" openai.api_key = 'placeholder' # Replace with your OpenAI key
-
Run the script:
python voice-communication-gpt4.py
-
Interact with the application GUI to start and end voice recording.
This project is licensed under the MIT License - see the LICENSE.md file for details