Skip to content

HRTCloudDemo/HRTTranslationDemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HRTTranslationDemo

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 --kind nodejs:default src/detect-language.js --param-file config/ai-params.json --web true

translate:

ibmcloud fn action update hrt-demo/translate --kind nodejs:default 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

Further information

Language Translator API HowTo extend Cloud Functions Runtime images