Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small Fixes #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
0. Log in to the [Cloud Console](https://console.cloud.google.com).
0. Go to **API Manager** -> **Library** and enable both the Google Cloud Translation API and the Google Cloud Speech API.
0. Go to **IAM & Admin** -> **Service Accounts**.
0. Create a new service account with **Project -> Viewer** role. Furnish a new private key, with key type json. A credential file will download. Rename it to `service-account-credentails.json` and copy it to `/functions`.
0. Create a new service account with **Project -> Viewer** role. Furnish a new private key, with key type json. A credential file will download. Rename it to `service-account-credentials.json` and copy it to `/functions`.
0. Deploy the Cloud Functions [with the Firebase CLI](https://firebase.google.com/docs/functions/get-started)

## Files
Expand All @@ -28,4 +28,4 @@

- [Firebase Database](https://firebase.google.com/docs/database)
- [Firebase Storage](https://firebase.google.com/docs/storage/)
- [Cloud Functions for Firebase](https://firebase.google.com/docs/functions/)
- [Cloud Functions for Firebase](https://firebase.google.com/docs/functions/)
3 changes: 2 additions & 1 deletion js/functions/index.done.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ exports.onUpload = functions.database
var language = data.language ? data.language : "en";
var encoding = data.encoding ? data.encoding : "FLAC";
var sampleRate = data.sampleRate ? data.sampleRate : 16000;
var storageBucket = functions.config().firebase.storageBucket;

return speech.recognize(`gs://mimming-babelfire.appspot.com/${data.fullPath}`, {
return speech.recognize(`gs://${storageBucket}/${data.fullPath}`, {
encoding: encoding,
sampleRate: sampleRate,
languageCode: language
Expand Down
3 changes: 2 additions & 1 deletion js/functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ exports.onUpload = functions.database
var language = data.language ? data.language : "en";
var encoding = data.encoding ? data.encoding : "FLAC";
var sampleRate = data.sampleRate ? data.sampleRate : 16000;
var storageBucket = functions.config().firebase.storageBucket;

return speech.recognize(`gs://mimming-babelfire.appspot.com/${data.fullPath}`, {
return speech.recognize(`gs://${storageBucket}/${data.fullPath}`, {
encoding: encoding,
sampleRate: sampleRate,
languageCode: language
Expand Down
3 changes: 2 additions & 1 deletion js/functions/index.livecode.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ exports.onUpload = functions.database
var language = data.language ? data.language : "en";
var encoding = data.encoding ? data.encoding : "FLAC";
var sampleRate = data.sampleRate ? data.sampleRate : 16000;
var storageBucket = functions.config().firebase.storageBucket;

// Send the file to the Cloud Speech API to get the transcript
return speech.recognize(`gs://mimming-babelfire.appspot.com/${data.fullPath}`, {
return speech.recognize(`gs://${storageBucket}/${data.fullPath}`, {
encoding: encoding,
sampleRate: sampleRate,
languageCode : language
Expand Down