Build and publish the custom Docker image into your DockerHub account
./buildAndPush.sh <dockerhub-repo>/cloud-functions-ai-translator:v1
Adjust the local config file and enter your AI Language Translator API key
vi config/ai-params.json
Login to the IBM Cloud
ibmcloud --login
Create the Package
ibmcloud fn package create hrt-demo
Create the Cloud Functions Actions
detect-language:
ibmcloud fn action update hrt-demo/detect-language --docker <dockerhub-repo>/cloud-functions-ai-translator:v1 src/detect-language.js --param-file config/ai-params.json --web true
translate:
ibmcloud fn action update hrt-demo/translate --docker ibmarc/cloud-functions-ai-translator:latest src/translate.js -P config/ai-params.json --web true
Create a sequence to bind pipe both actions together:
ibmcloud fn action create hrt-demo/identify-and-translate --sequence hrt-demo/detect-language,hrt-demo/translate --web true
Test the Action
- via CLI
ibmcloud fn action invoke hrt-demo/detect-language -p text "hi there. this is awesome"
ibmcloud fn action invoke hrt-demo/identify-and-translate -p text "Wer hat and der Uhr gedreht? Ist es wirklich schon so spät?" -r
Language Translator API HowTo extend Cloud Functions Runtime images