Skip to content

tfrantzen/gcp-ml-walkthrough

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

*This is not an official GCP repository

Google Cloud ML Walkthrough Demo

Introduction

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.

Architecture

architecture

Pre-Requisites

  1. Need a Google Cloud Platform account

Setup

  1. Create GCP Project
  2. Activate Google Cloud Shell
  3. Set your session to the current project
    gcloud config set project <PROJECT NAME>
    
  4. 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
    
  5. Create an API key

Speech Client Compute Engine

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.

  1. 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
    
  2. SSH into the new instance
  3. Install git and maven
    sudo apt-get update
    sudo apt-get install -y maven openjdk-8-jdk git
    
  4. 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
    
  5. Clone this project
    git clone https://github.com/tfrantzen/gcp-ml-walkthrough.git
    
  6. Open directory
    cd gcp-ml-walkthrough/streaming-client/
    
  7. Deploy application
    sudo mvn clean jetty:run
    

ML Walkthrough Application

  1. Open the Google Cloud Shell
  2. Clone project
    git clone https://github.com/tfrantzen/gcp-ml-walkthrough.git
    
  3. Open directory
    cd gcp-ml-walkthrough/client/
    
  4. Install dependencies
    npm install
    
  5. Collect GCE IP Address and API Key
  6. 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...
    
  7. Deploy application
    npm start
    
  8. Open the web preview
    • You will need to navigate your speech-client GCE instance first to accept the self signed certificate

Sources

  1. https://codelabs.developers.google.com/codelabs/speaking-with-a-webpage/index.html?index=..%2F..%2Findex#0
  2. https://webrtc.github.io/samples/
  3. https://github.com/GoogleCloudPlatform

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published