*This is not an official GCP repository
This web application integrates Google Cloud Vision, Google Cloud Speech, Google Cloud Translate, and Google Cloud Natural Language with WebRTC as a audio/video source.
- Need a Google Cloud Platform account
- Create GCP Project
- Activate Google Cloud Shell
- Set your session to the current project
gcloud config set project <PROJECT NAME>
- Enable Compute Engine, Vision, Speech, Translate, and Natural Language APIs
gcloud services enable compute.googleapis.com vision.googleapis.com speech.googleapis.com translate.googleapis.com language.googleapis.com vision.googleapis.com
- Create an API key
This application uses Google Cloud Speech streaming API. In order to stream audio from the web application to the Speech API, you will need to create a GCE instance to setup a secure web socket. This was originally setup using the Speaking with a Webpage codelab.
- Create a micro GCE instance
gcloud beta compute --project=$(gcloud config get-value project) instances create speech-client --zone=us-east1-b --machine-type=n1-standard-1 --subnet=default --scopes=https://www.googleapis.com/auth/cloud-platform --tags=https-server --image=debian-9-stretch-v20180611 --image-project=debian-cloud --boot-disk-size=10GB --boot-disk-type=pd-standard --boot-disk-device-name=speech-client
- SSH into the new instance
- Install git and maven
sudo apt-get update sudo apt-get install -y maven openjdk-8-jdk git
- In order to access the speech client, you will need to open a port in the Firewall
gcloud compute firewall-rules create dev-ports --allow=tcp:443 --source-ranges=0.0.0.0/0
- Clone this project
git clone https://github.com/tfrantzen/gcp-ml-walkthrough.git
- Open directory
cd gcp-ml-walkthrough/streaming-client/
- Deploy application
sudo mvn clean jetty:run
- Open the Google Cloud Shell
- Clone project
git clone https://github.com/tfrantzen/gcp-ml-walkthrough.git
- Open directory
cd gcp-ml-walkthrough/client/
- Install dependencies
npm install
- Collect GCE IP Address and API Key
- Edit public\js\app.js, update variables on line 1 and 2
... var apiKey = '<API_KEY>'; var speechApiIP = '<GCE_INSTANCE_EXTERNAL_IP>'; var translateUri = `https://translation.googleapis.com/language/translate/v2?ke...
- Deploy application
npm start
- Open the web preview
- You will need to navigate your speech-client GCE instance first to accept the self signed certificate