This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"annotation_results": [ { | |
"input_uri": "/family_videos/myuserid/multi_shot_test.mp4", | |
"segment": { | |
"start_time_offset": { | |
}, | |
"end_time_offset": { | |
"seconds": 70, | |
"nanos": 983000000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Media Translation Stream | |
* @param audio stream | |
* @param cb Callback function to execute with results | |
*/ | |
async function transcribeAudioMediaStream(audio, cb) { | |
var isFirst = true; | |
const initialRequest = { | |
streamingConfig: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Copyright 2020 Google LLC | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let queryResult; | |
return new Promise(resolve => { | |
let silent = true | |
detectStream.on('data', data => { | |
if (data.recognitionResult) { | |
silent = false | |
console.log( | |
`Intermediate transcript: ${data.recognitionResult.transcript}` | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright 2020 Google Inc. All Rights Reserved. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model = tf.keras.models.Sequential([ | |
tf.keras.layers.Dense(512, activation='relu'), | |
tf.keras.layers.Dropout(0.2), | |
tf.keras.layers.Dense(32, activation='relu'), | |
tf.keras.layers.Dense(1, activation='softmax') | |
]) | |
model.compile(optimizer='adam', | |
loss='sparse_categorical_crossentropy'), | |
metrics=['accuracy'])) | |
model.fit(x_train, y_train, epochs=5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const dialogflow = require('dialogflow'); | |
const common = require('@google-cloud/common'); | |
const record = require('node-record-lpcm16'); | |
const uuidv1 = require('uuid/v1'); | |
const pump = require('pump'); | |
const Transform = require('readable-stream').Transform; | |
const fs = require('fs'); | |
const Speaker = require('speaker'); | |
const { PassThrough } = require('stream'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# import microphone_stream | |
import dialogflow_v2 as dialogflow | |
import pyaudio | |
import simpleaudio as sa | |
import re | |
import os | |
import sys | |
import time | |
PROJECT_ID = os.environ["PROJECT_ID"] |