-
Notifications
You must be signed in to change notification settings - Fork 0
Configure IBM Cloud
Important
The instructions below reflect the general steps needed to set up AI services on IBM Cloud. As cloud service providers redesign their user interfaces, the specific steps you need to perform may vary.
There are two AI services you can set up on IBM Cloud:
Note
In the past, TJBot used the IBM Watson Visual Recognition service to perform computer vision tasks. This service was shut down at the end of 2021 and can no longer be used.
To create your own instances of these services, you first need to sign up for an IBM Cloud account if you do not have one already. Visit IBM Cloud and click "Create an account" to create a new account. You may also sign in with your existing Google account.
Note
As part of the sign up process, you may be asked to enter credit card information for billing. IBM Cloud offers trial versions of many services, including Text to Speech and Speech to Text, so you should be able to try these services with your TJBot at no cost.
Note
The instructions below use "Speech to Text" as an example but the steps are the same for "Text to Speech."
- In the Cloud sidebar, click "Browse all services…", then click "AI / Machine learning" in the left panel, and scroll down to find "Speech to Text." Alternatively, you can search for "Speech to Text" in the search bar.
- Click on "Speech to Text" to create an instance of the service.
- Choose the location in which you would like the service deployed (e.g. "Washington DC (us-east)" or "Dallas (us-south)" for users in the United States).
- Choose which pricing plan you would like (we recommend starting with the free "Lite" tier).
- Optional: Give your service a friendly name, like "TJBot Speech to Text," so you know what this service is for.
- In the right sidebar, agree to the license agreement and click "Create" to create an instance of the service.
After creating your service instances, in the Cloud sidebar, navigate to "Resource list." Expand the "AI / Machine Learning" category to see the instances of your services. For each service:
- Click on the name of the service (e.g. "TJBot Speech to Text") to open the details page.
- Click the download button in the "Credentials" box.
At this point, if you have created instances for both Speech to Text and Text to Speech, you will have downloaded two files named ibm-credentials.env. Your browser likely renamed one of them to ibm-credentials (1).env. You will need to combine the contents of both files into a single file named ibm-credentials.env. You can do this using your favorite text editor, or you can use the following command in the Terminal (assuming the credentials files were downloaded to ~/Downloads):
cd ~/Downloads
cat <(echo) "ibm-credentials (1).env" >> ibm-credentials.env
rm "ibm-credentials (1).env"Note
The echo command is used to insert a newline at the end of the .env file. Without this newline, the credentials will not be defined correctly. Also, the >> is used to append the content from one credentials file to the other; if a > is used, it will overwrite the existing content in that file and you will need to re-download the credentials file again.
After this step, you will have a single ibm-credentials.env file. It should look like this (note that actual API keys have been truncated):
% cat ibm-credentials.env
TEXT_TO_SPEECH_APIKEY=mTL…
TEXT_TO_SPEECH_IAM_APIKEY=mTL…
TEXT_TO_SPEECH_URL=https://api.us-east.text-to-speech.watson.cloud.ibm.com/instances/872f1cde…
TEXT_TO_SPEECH_AUTH_TYPE=iam
SPEECH_TO_TEXT_APIKEY=o5u…
SPEECH_TO_TEXT_IAM_APIKEY=o5u…
SPEECH_TO_TEXT_URL=https://api.us-east.speech-to-text.watson.cloud.ibm.com/instances/a802bc56-…
SPEECH_TO_TEXT_AUTH_TYPE=iam%Warning
The ibm-credentials.env file contains authentication credentials for your IBM Cloud services. Keep this file secret and do not share it. Also, do not check it in to a GitHub repository or other source control system. Otherwise, others may be able to use your IBM Cloud services, including services for which you may be billed.
The next step is to copy your ibm-credentials.env file to your TJBot's ~/.tjbot directory.
cd ~/Downloads
scp ibm-credentials.env pi@tjbot.local:~/.tjbotNote
The exact commands you use will differ. This example assumes the .env file was downloaded to your ~/Downloads/ that the account name on your Raspberry Pi is pi, and that the network address of your TJBot is tjbot.local.
To enable IBM Cloud's AI services, update the following settings in your tjbot.toml file:
[listen.backend]
type = 'ibm-watson-stt'
[speak.backend]
type = 'ibm-watson-tts'If you wish to store your credentials file in an alternative location, simply update your tjbot.toml configuration to specify that location. The relevant keys to update are:
[speak.backend.ibm-watson-tts]
credentialsPath = "<path to your ibm-credentials.env file>"
[listen.backend.ibm-watson-stt]
credentialsPath = "<path to your ibm-credentials.env file>"Each IBM Cloud AI service has a number of service-specific settings you can configure, such as the voice used for Text-to-Speech and confidence thresholds for computer vision tasks. Please review tjbot.toml to learn more about these settings.
Note: If you see an issue with this Wiki, please open a Wiki issue