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
//gcloud functions deploy processData --runtime nodejs10 --trigger-resource mysandoxbucket --trigger-event google.storage.object.finalize --project sandbox-project | |
//set the vars | |
const datasetId = 'openspace2020'; | |
const tableId = 'imageData'; | |
//load the dependences | |
const {BigQuery} = require('@google-cloud/bigquery'); | |
const bigquery = new BigQuery(); | |
const vision = require('@google-cloud/vision'); | |
const client = new vision.ImageAnnotatorClient(); |
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
//gcloud functions deploy getData --runtime nodejs12 --trigger-resource mysandoxbucket --trigger-event google.storage.object.finalize --project my-sandbox-project | |
exports.getData = async (file, context) => { | |
//set the vars | |
const bucketName = "mysandoxbucket"; | |
//load the dependences | |
const vision = require('@google-cloud/vision'); | |
console.log(`Data for ${file.name}:`); | |
//Ask for labels of image |
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 count = 0; | |
exports.helloWorld = (req, res) => { | |
count++; | |
if(count<5){ | |
res.status(500).json({"error": "System error"}); | |
}else{ | |
res.status(200).json({"llamada": count}); | |
} | |
}; |
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
{ | |
"name": "encode-md5", | |
"version": "0.0.1", | |
"dependencies": { | |
"md5": "^2.3.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
- getCurrentTime: | |
call: http.get | |
args: | |
url: http://worldtimeapi.org/api/timezone/Europe/Madrid | |
result: CurrentDateTime | |
- readWikipedia: | |
call: http.get | |
args: | |
url: https://en.wikipedia.org/w/api.php | |
query: |
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
FROM docker:19.03.11 as static-docker-source | |
FROM debian:buster | |
ARG CLOUD_SDK_VERSION=299.0.0 | |
ENV CLOUD_SDK_VERSION=$CLOUD_SDK_VERSION | |
ENV CLOUDSDK_PYTHON=python3 | |
ENV PATH "$PATH:/opt/google-cloud-sdk/bin/" | |
COPY --from=static-docker-source /usr/local/bin/docker /usr/local/bin/docker | |
RUN apt-get -qqy update && apt-get install -qqy \ | |
curl \ |
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
<script src="https://unpkg.com/@tensorflow/tfjs"></script> | |
<script src="https://unpkg.com/@tensorflow/tfjs-automl"></script> | |
<img id="daisy" crossorigin="anonymous" src="/hattori.jpeg"> | |
<script> | |
async function run() { | |
const model = await tf.automl.loadImageClassification('model.json'); | |
const image = document.getElementById('daisy'); | |
const predictions = await model.classify(image); | |
console.log(predictions); | |
// Show the resulting object on the page. |
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
FROM gcr.io/automl-vision-ondevice/gcloud-container-1.12.0:latest | |
RUN mkdir -p /tmp/mounted_model/0001/ | |
COPY saved_model.pb /tmp/mounted_model/0001/ |
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
SELECT count(repo_name) as numberOfRepos, lang_data.name | |
FROM `bigquery-public-data.github_repos.languages`, UNNEST(language) AS lang_data | |
WHERE lang_data.name IN ("JavaScript","Java","Python","Ruby","PHP","C","Go") AND | |
repo_name IN ( | |
SELECT repo_name | |
FROM `bigquery-public-data.github_repos.sample_repos` | |
WHERE watch_count>10 | |
ORDER BY watch_count | |
) | |
GROUP BY lang_data.name |
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
runtime: nodejs10 | |
service: default |
NewerOlder