This Python script demonstrates how to use Azure Cognitive Services Speech and OpenAI to perform speech-to-text and text-to-speech operations.
- Python 3.x
- Azure Cognitive Services Speech subscription key and region
- Azure OpenAI API key and API endpoint base URL
Note: Follow my post here for a detailed guide on how to set up Azure Cognitive Services and OpenAI.
- Clone the repository to your local machine.
- Install the required Python packages using pip:
pip install -r requirements.txt
. - Set the environment variables for the Azure Cognitive Services Speech subscription key and region, and the OpenAI API key and API base URL.
- export cognitive_services_speech_key=<KEY_VALUE>
- export openai_api_key=<KEY_VALUE>
- export openai_api_base=https://.openai.azure.com
- Run the
start.py
script using Python:python start.py
. - Speak into the microphone when prompted.
- The script will recognize your speech and generate a response using OpenAI.
- The response will be synthesized into speech and played through the speakers.
This project is licensed under the MIT License - see the LICENSE file for details.