To begin with IBM’s API, you first need to have an IBM Cloud account. Once you have created your account, follow the following steps.
- from the top left navigation menu on the dashboard, go to Resources list.
- then, click on Create Resource.
- then, in the categories section, select AI and select Speech to Text. Create your service without changing anything.
- after your service is created, click on the service.
- select manage from the navigation menu and click on show credentials.
- copy the api key and url generated.
- do the same steps to create Text to Speech service.
Run the following commands in the terminal.
pip install --upgrade "ibm-watson>=5.2.2"
pip install SpeechRecognition
Place your IBM Watson Service credentials in main.py
# Speech to Text service credentials
stt_api = 'YOUR_API_KEY'
stt_url = 'YOUR_URL'
# Text to Speech service credentials
tts_api = 'YOUR_API_KEY'
tts_url = 'YOUR_URL'