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

chore(vision): migrate code from googleapis/nodejs-vision #2858

Merged
merged 213 commits into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
213 commits
Select commit Hold shift + click to select a range
4498905
Add Cloud Vision face detection sample.
jmdobry May 11, 2016
a034a5b
Add Cloud Vision label detection sample.
jmdobry May 12, 2016
7439369
Add Cloud Vision landmark detection sample.
jmdobry May 13, 2016
e69dc4d
Add Cloud Vision text detection sample.
jmdobry May 16, 2016
fe0f757
Switched from JSHint to Semistandard and upgraded dependencies.
jmdobry May 23, 2016
fec6285
Switch back to mocha from ava. (#143)
jmdobry Jun 30, 2016
5f9b9c2
Refactored tests (#159)
jmdobry Aug 3, 2016
f99996d
* Refactored Pub/Sub samples into nice command-line programs, like th…
jmdobry Aug 10, 2016
d64d538
Switch to individual API packages. (#169)
jmdobry Aug 16, 2016
a49d825
New quickstarts. (#226)
jmdobry Oct 3, 2016
caaaf66
Updated copyright headers and dependencies.
jmdobry Nov 14, 2016
49704f5
Refactor Cloud Functions samples. (#245)
jmdobry Nov 16, 2016
65d136d
Update storage samples. (#263)
jmdobry Dec 9, 2016
c637d3b
Switch from Mocha to Ava for faster tests (#289)
jmdobry Jan 6, 2017
ef7d36f
Switch to Yarn for CI build. (#290)
jmdobry Jan 9, 2017
4e070aa
Vision snippets. (#294)
jmdobry Jan 10, 2017
9491c47
Update Vision samples to be easier to read. Update dependencies. (#312)
jmdobry Feb 3, 2017
b05f5ec
Remove unused Vision samples.
jmdobry Feb 3, 2017
443610f
Adds vision 1.1 features (#318)
gguuss Mar 6, 2017
51460b9
Travis: fix failing tests + update dependencies (#335)
Apr 5, 2017
53c5293
Bring ML APIs up to standard. (#346)
jmdobry Apr 12, 2017
1354bc9
Cleanup App Engine samples and re-work tests. (#354)
jmdobry Apr 24, 2017
5323de2
Upgrade to repo tools v1.4.7 (#370)
jmdobry May 2, 2017
422cc00
Upgrade repo tools and regenerate READMEs. (#384)
jmdobry May 10, 2017
0eda176
Upgrade repo tools and regenerate READMEs.
jmdobry May 16, 2017
4211991
Upgrades vision to partial-GAPIC (#434)
gguuss Jul 31, 2017
43999a6
Remove incorrect option.
jmdobry Aug 22, 2017
c2eb8d7
Fixed region tag.
jmdobry Aug 22, 2017
99dbd02
Build updates. (#462)
jmdobry Aug 23, 2017
8ad42f5
Tweak comments in Vision samples.
jmdobry Oct 26, 2017
0c319f1
Repository Migration (#4)
lukesneeringer Nov 17, 2017
8406dc7
Coerce requests from string or buffer. (#5)
lukesneeringer Nov 28, 2017
26e5f89
Version bump to 0.13.0 (#7)
lukesneeringer Nov 28, 2017
b858e6a
Add the v1p1beta1 endpoint. (#11)
lukesneeringer Dec 5, 2017
86b3477
Bump version to 0.14.0 (#12)
lukesneeringer Dec 5, 2017
68105af
Remove unused "imports" region tag from v1p1beta1 sample (#13)
beccasaurus Jan 11, 2018
a44a2d0
feat: update GAPIC generated code (v1), bump semver minor version (#24)
alexander-fenster Jan 30, 2018
b59965e
releasing v0.15.1 (#29)
alexander-fenster Feb 10, 2018
01fdf52
releasing 0.15.2 with updated dependencies (#30)
alexander-fenster Feb 13, 2018
c993826
feat: generating GAPIC code for v1p2beta1 (#33)
alexander-fenster Mar 3, 2018
7affd50
Upgrade repo-tools and regenerate scaffolding. (#37)
jmdobry Mar 17, 2018
8ee1650
v0.17.0 (#38)
callmehiphop Mar 19, 2018
d8824eb
chore: make samples depend on the current version (#40)
alexander-fenster Mar 21, 2018
3cebbf4
Update @google-cloud/common to the latest version 🚀 (#42)
greenkeeper[bot] Mar 22, 2018
5cfa0f1
Update sinon to the latest version 🚀 (#41)
greenkeeper[bot] Mar 23, 2018
95d2e92
release 0.18.0 (#44)
alexander-fenster Mar 26, 2018
b5d4480
Created a sample code to demo how to scan a pdf file (#48)
happyhuman Apr 3, 2018
e627e33
Fixed the failing unit test. (#50)
happyhuman Apr 4, 2018
a8fdac7
chore: bump version to 0.19.0 (#51)
alexander-fenster Apr 4, 2018
6eae9dd
Vision GA Samples (#52)
beccasaurus Apr 5, 2018
44fc0f0
chore: lock files maintenance (#58)
alexander-fenster May 2, 2018
80378f3
chore: lock files maintenance (#62)
alexander-fenster May 8, 2018
dfe677e
Using a different image to fix the unit test (#66)
happyhuman May 21, 2018
39471a9
chore: lock files maintenance (#68)
alexander-fenster May 22, 2018
f48de1e
testing with the most reliable found entry. (#69)
happyhuman May 24, 2018
e39e054
bump version to 0.20.0 (#79)
crwilcox Jun 15, 2018
e2ae64e
chore: update many dependencies (#81)
JustinBeckwith Jun 17, 2018
db1951c
chore: Re-generate library using /synth.py (#88)
dpebot Jun 22, 2018
03a1744
fix: update linking for samples (#92)
JustinBeckwith Jun 25, 2018
f80bb6f
chore: update sample lockfiles (#95)
JustinBeckwith Jun 25, 2018
16c0bf0
refactor: drop repo-tool as an exec wrapper (#97)
JustinBeckwith Jun 26, 2018
c62bdb7
fix(deps): update dependency yargs to v12 (#103)
renovate[bot] Jun 27, 2018
c177e01
fix: update and cleanup dependencies (#102)
JustinBeckwith Jun 27, 2018
cff215d
Beta2ga pdf ocr (#104)
happyhuman Jul 2, 2018
6ca2d6c
chore(deps): lock file maintenance (#108)
renovate[bot] Jul 3, 2018
f35a4cb
chore(deps): lock file maintenance (#112)
renovate[bot] Jul 3, 2018
a23f525
chore(deps): lock file maintenance (#118)
renovate[bot] Jul 10, 2018
9d4e0cc
chore(deps): lock file maintenance (#119)
renovate[bot] Jul 10, 2018
5dceaea
chore(deps): lock file maintenance (#121)
renovate[bot] Jul 10, 2018
901c51e
chore(deps): lock file maintenance (#123)
renovate[bot] Jul 17, 2018
8da00cf
Code Samples demonstrating Object Localization & Handwriting OCR (#133)
CallistoCF Jul 24, 2018
f5d335f
chore(deps): lock file maintenance (#135)
renovate[bot] Jul 24, 2018
fb35ad2
fix(deps): update dependency @google-cloud/vision to ^0.21.0 (#131)
renovate[bot] Jul 24, 2018
1e73872
chore: drop dependency on common (#134)
JustinBeckwith Jul 24, 2018
935adbd
Re-generate library using /synth.py (#138)
dpebot Jul 25, 2018
56f1c6b
chore: require node 8 for samples (#142)
JustinBeckwith Jul 30, 2018
9fb27f9
chore(deps): lock file maintenance (#144)
renovate[bot] Jul 31, 2018
a25599b
Release nodejs-vision v0.21.1 (#148)
jkwlui Aug 2, 2018
c58e0ce
fix(samples): missing fs requires causing sample-test to fail (#157)
jkwlui Aug 6, 2018
d6d3cf3
chore: ignore package-lock.json (#160)
JustinBeckwith Aug 7, 2018
c913cb2
Vision region tag update (#171)
alixhami Aug 15, 2018
d74b2c8
Udpate Beta Vision samples to use beta tags (#172)
alixhami Aug 16, 2018
a0ab1c5
fix: (tests): Use real service to validate expectations. (#182)
stephenplusplus Aug 31, 2018
64c7f29
Updated CI config and run synth (#181)
dpebot Sep 4, 2018
ae39a79
Fix the sample tests (#187)
JustinBeckwith Sep 8, 2018
279b932
chore(deps): update dependency @google-cloud/storage to v2 (#183)
renovate[bot] Sep 10, 2018
bcbd3a0
Release v0.22.0 (#190)
jkwlui Sep 11, 2018
1bc7f0a
Product search rebased (#196)
nirupa-kumar Sep 18, 2018
4db80be
Fix response output for Detect Labels (#199)
beccasaurus Sep 18, 2018
f789569
Enable no-var in eslint (#198)
JustinBeckwith Sep 18, 2018
0d12ae8
Enable prefer-const in the eslint config (#201)
JustinBeckwith Sep 20, 2018
87e1d12
Vision GA – vision_localize_objects & vision_localize_object_gcs (#200)
nirupa-kumar Sep 21, 2018
0bdc60a
Release v0.22.1 (#205)
JustinBeckwith Sep 22, 2018
7b4b7b8
docs: Vision AutoML samples (#197)
nirupa-kumar Sep 27, 2018
134a0e6
Update kokoro config (#214)
dpebot Oct 2, 2018
d689d0c
fix(samples): Change the Project ID from number to string (#220)
normankong Oct 14, 2018
d754fa5
fix(samples): Adding vision_product_search_tutorial_import tags (#221)
nirupa-kumar Oct 15, 2018
d9bec66
chore(deps): update dependency sinon to v7 (#219)
renovate[bot] Oct 15, 2018
8bbf003
chore(deps): update dependency canvas to v2 (#224)
renovate[bot] Oct 18, 2018
ec1263f
chore: update lint configs (#257)
JustinBeckwith Nov 6, 2018
42a7a82
feat: release v0.23.0 (#259)
jkwlui Nov 8, 2018
2fa4b42
fix(deps): update dependency @google-cloud/vision to ^0.23.0 (#260)
renovate[bot] Nov 8, 2018
faa9cbc
chore(deps): update dependency @google-cloud/nodejs-repo-tools to v3 …
renovate[bot] Nov 10, 2018
b876b17
docs(samples): updated samples code to use async/await and tests to u…
vijay-qlogic Nov 18, 2018
d1056e3
fix: Param "scoreThreshold" should be "score_threshold" (#234)
normankong Nov 26, 2018
cb47bd6
test: make product search tests run (#269)
nirupa-kumar Nov 29, 2018
4f1ec49
ProductSearch GA (#280)
nirupa-kumar Nov 29, 2018
9107649
chore: modernize the samples and sample tests (#297)
JustinBeckwith Dec 18, 2018
870f233
BREAKING: rename method imagePath => referenceImagePath (#296)
yoshi-automation Dec 19, 2018
7baa84f
Release v0.24.0 (#298)
jkwlui Dec 19, 2018
8b4218c
docs: improve detect.js samples (#300)
nnegrey Jan 2, 2019
0332637
fix: ignore case in system test assertions (#314)
JustinBeckwith Jan 27, 2019
8390c1d
fix(deps): update dependency yargs to v13 (#325)
renovate[bot] Feb 12, 2019
3c6be44
chore(deps): update dependency mocha to v6 (#330)
renovate[bot] Feb 19, 2019
ea59fbc
Release v0.25.0 (#336)
jkwlui Feb 25, 2019
3efee51
docs(samples): move automl samples to nodejs-automl (#332)
jkwlui Mar 3, 2019
b6f72f6
Samples for batch PDF and image annotation. (#347)
happyhuman Mar 20, 2019
89972ee
fix(samples): make test assertion less specific (#354)
callmehiphop Apr 2, 2019
b809154
refactor: use execSync for tests (#355)
JustinBeckwith Apr 5, 2019
3092b85
tests: fix broken sample tests (#373)
callmehiphop May 7, 2019
1d9f424
chore: release 1.0.0 (#380)
bcoe May 13, 2019
a8b581c
chore: release 1.1.0 (#394)
yoshi-automation Jun 5, 2019
b0abfe6
refactor: changes formatting of various statements
yoshi-automation Jun 7, 2019
ff9eebc
docs: fix authentication docs URL in comment (#397)
gondar00 Jun 7, 2019
09938aa
fix(deps): update dependency mathjs to v6 (#399)
renovate[bot] Jun 11, 2019
cea827a
chore: release 1.1.1 (#400)
yoshi-automation Jun 11, 2019
6a46233
chore: release 1.1.2 (#404)
yoshi-automation Jun 16, 2019
2a549ed
chore: release 1.1.3 (#407)
yoshi-automation Jun 26, 2019
897ddb2
chore: release 1.1.4 (#419)
yoshi-automation Aug 5, 2019
5abb8ec
chore: release 1.2.0 (#422)
yoshi-automation Aug 19, 2019
917c672
test(samples): make detect assertions less specific (#433)
callmehiphop Sep 5, 2019
29031d5
fix(samples): upgrade yargs and fix broken CLI config (#436)
bcoe Sep 6, 2019
79aad31
chore: release 1.3.0 (#437)
yoshi-automation Sep 9, 2019
c61bd63
chore: release 1.4.0 (#442)
yoshi-automation Sep 14, 2019
dc39e61
docs(samples): purge products (#429)
steffnay Sep 18, 2019
01d78b5
tests: fixture resources have moved (#454)
bcoe Sep 27, 2019
d8a77a2
chore(deps): update dependency @google-cloud/storage to v4 (#463)
renovate-bot Oct 18, 2019
b39b16e
feat: added endpoint samples for vision api (#467)
bradmiro Oct 29, 2019
87ab2b7
revert: added endpoint samples for vision api
bradmiro Oct 29, 2019
6c8886d
chore: release 1.6.0 (#470)
release-please[bot] Nov 5, 2019
676f580
chore: release 1.7.0 (#478)
release-please[bot] Nov 8, 2019
ec2cbe4
refactor: run prettier (#479)
yoshi-automation Nov 9, 2019
15f2a11
chore: release 1.7.1 (#483)
release-please[bot] Nov 13, 2019
92676be
fix(deps): update dependency yargs to v15 (#488)
renovate-bot Nov 18, 2019
f0f6dc7
chore: release 1.7.2 (#490)
release-please[bot] Nov 18, 2019
23a1522
chore: update license headers (#493)
JustinBeckwith Nov 25, 2019
3de2ae4
feat(samples): add sample of configuring alternate apiEndpoint (#473)
bradmiro Nov 26, 2019
938aeee
refactor: use explicit mocha imports (#505)
JustinBeckwith Dec 30, 2019
3412348
chore: release 1.8.0 (#492)
release-please[bot] Jan 2, 2020
52ba5a2
chore(deps): update dependency mocha to v7
renovate-bot Jan 6, 2020
7987883
docs(samples): splits product search samples into separate files (#527)
steffnay Feb 5, 2020
38746b5
fix(deps): update dependency redis to v3 (#533)
renovate-bot Feb 10, 2020
ee9b2c1
chore: release 1.9.0 (#531)
release-please[bot] Feb 10, 2020
bb7124a
chore(deps): update dependency uuid to v7
renovate-bot Feb 26, 2020
1131d29
chore: release 1.10.0 (#546)
release-please[bot] Mar 3, 2020
d9a966f
docs: update beta samples to v1 and style (#553)
nnegrey Mar 11, 2020
2cc70bb
chore: release 1.11.0 (#548)
release-please[bot] Mar 11, 2020
47bc245
feat!: drop node8 support, support for async iterators (#568)
alexander-fenster Apr 1, 2020
1c1e8e2
fix(deps): update dependency natural to v1 (#768)
renovate-bot Apr 28, 2020
17e17d7
fix(samples): use pureimage instead of canvas (#774)
alexander-fenster May 6, 2020
4b4853b
chore(deps): update dependency uuid to v8 (#770)
renovate-bot May 6, 2020
7f3d72a
fix(deps): update dependency natural to v2 (#772)
renovate-bot May 6, 2020
3cd8df9
fix(deps): update dependency mathjs to v7 (#775)
renovate-bot May 18, 2020
6dc55a8
chore(deps): update dependency @google-cloud/storage to v5 (#776)
renovate-bot May 18, 2020
2b48199
chore: release 2.0.0 (#572)
release-please[bot] Jun 4, 2020
c61d2ca
chore: release 2.1.0 (#791)
release-please[bot] Jun 15, 2020
33fc5c7
chore(deps): update dependency mocha to v8 (#794)
renovate-bot Jun 16, 2020
4fc2941
chore: release 2.1.1 (#796)
release-please[bot] Jul 10, 2020
39c1808
fix(deps): update dependency yargs to v16 (#824)
renovate-bot Sep 9, 2020
a2e86d3
chore: release 2.1.2 (#825)
release-please[bot] Sep 17, 2020
2feefa4
docs(samples): modernize the samples (#838)
JustinBeckwith Oct 26, 2020
03f23a9
chore: release 2.2.0 (#853)
release-please[bot] Jan 6, 2021
1171cd7
chore: release 2.3.0 (#857)
release-please[bot] Jan 12, 2021
731e3b4
fix(deps): update dependency natural to v3 (#865)
renovate-bot Feb 3, 2021
4928362
fix(deps): update dependency natural to v4 (#870)
renovate-bot Feb 18, 2021
0c33ea9
chore: release 2.3.1 (#866)
release-please[bot] Feb 18, 2021
a7817fb
fix(deps): update dependency natural to v5 (#880)
renovate-bot Mar 30, 2021
0756e4c
chore: release 2.3.2 (#895)
release-please[bot] May 12, 2021
e328e8d
samples(deps): update dependency pureimage to ^0.3.0 (#882)
renovate-bot May 25, 2021
dc869a5
chore: removed duplicate v1p1beta1 samples (#910)
munkhuushmgl May 26, 2021
b4a3650
chore: release 2.3.3 (#909)
release-please[bot] Jun 3, 2021
903de7a
chore: release 2.3.4 (#918)
release-please[bot] Jun 22, 2021
675c8fe
chore: release 2.3.5 (#924)
release-please[bot] Jun 29, 2021
0f32c3c
chore: release 2.3.6 (#927)
release-please[bot] Jul 12, 2021
916678f
chore: release 2.3.7 (#929)
release-please[bot] Jul 21, 2021
c4d8edd
chore: release 2.3.8 (#940)
release-please[bot] Aug 17, 2021
0a61a30
chore: release 2.4.0 (#946)
release-please[bot] Sep 9, 2021
874d75d
fix: comment about gcsUri (#967)
andrewferlitsch Dec 10, 2021
c2a79fb
fix(deps): update dependency redis to v4 (#966)
renovate-bot Dec 14, 2021
c7eaa36
chore: release 2.4.1 (#969)
release-please[bot] Dec 14, 2021
15cd0ad
chore: release 2.4.2 (#978)
release-please[bot] Jan 6, 2022
4fc8c22
chore(deps): update dependency @google-cloud/storage to v6 (#1018)
renovate-bot Jul 5, 2022
78da559
build!: update library to use Node 12 (#1016)
sofisl Jul 5, 2022
1ea9e75
samples: update dependency redis to ~4.2.0 (#1027)
renovate-bot Jul 6, 2022
3f50bd9
fix(deps): update dependency redis to ~4.3.0 (#1039)
renovate-bot Aug 26, 2022
8a3946e
chore(main): release 3.0.0 (#1014)
release-please[bot] Sep 7, 2022
50c8a5d
chore(deps): update dependency uuid to v9 (#1043)
renovate-bot Sep 8, 2022
9a489b7
fix: preserve default values in x-goog-request-params header (#1044)
gcf-owl-bot[bot] Sep 21, 2022
16d5be7
chore(main): release 3.0.1 (#1066)
release-please[bot] Sep 26, 2022
6df37a6
build(samples test): added imageContext to ImprovedRequest (#1069)
galz10 Oct 4, 2022
1b728af
Merge remote-tracking branch 'migration/main' into nodejs-vision-migr…
telpirion Nov 16, 2022
1d29358
Merge branch 'main' into nodejs-vision-migration
telpirion Nov 18, 2022
fb27ec2
chore: update workflows for Vision
telpirion Nov 18, 2022
1e48f69
removed unused snippet
telpirion Nov 18, 2022
5759569
removed unneeded test, added ProductSearch to workflows
telpirion Nov 18, 2022
101bebd
iter
telpirion Nov 18, 2022
4a106f0
fixing tests (hopefully)
telpirion Nov 18, 2022
5244f7c
adjustments
telpirion Nov 18, 2022
b85e627
per reviewer
telpirion Nov 18, 2022
836d9d3
Merge branch 'main' into nodejs-vision-migration
telpirion Nov 18, 2022
992f531
Merge branch 'main' into nodejs-vision-migration
telpirion Nov 18, 2022
a808e6a
filtering workflow paths
telpirion Nov 18, 2022
2195c48
Merge branch 'main' into nodejs-vision-migration
telpirion Nov 22, 2022
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
68 changes: 68 additions & 0 deletions .github/workflows/vision-productSearch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: vision-productSearch
on:
push:
branches:
- main
paths:
- 'vision/productSearch/**'
pull_request:
paths:
- 'vision/productSearch/**'
pull_request_target:
types: [labeled]
paths:
- 'vision/productSearch/**'
schedule:
- cron: '0 0 * * 0'
jobs:
test:
if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }}
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: 'write'
pull-requests: 'write'
id-token: 'write'
steps:
- uses: actions/checkout@v3.1.0
with:
ref: ${{github.event.pull_request.head.sha}}
- uses: 'google-github-actions/auth@v1.0.0'
with:
workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider'
service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com'
create_credentials_file: 'true'
access_token_lifetime: 600s
- uses: actions/setup-node@v3.5.1
with:
node-version: 16
- run: npm install
working-directory: vision/productSearch
- run: npm test
working-directory: vision/productSearch
env:
MOCHA_REPORTER_SUITENAME: vision_productSearch
MOCHA_REPORTER_OUTPUT: vision_productSearch_sponge_log.xml
MOCHA_REPORTER: xunit
- if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
await github.rest.issues.removeLabel({
name: 'actions:force-run',
owner: 'GoogleCloudPlatform',
repo: 'nodejs-docs-samples',
issue_number: context.payload.pull_request.number
});
} catch (e) {
if (!e.message.includes('Label does not exist')) {
throw e;
}
}
- if: ${{ github.event_name == 'schedule'}}
run: |
curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L
chmod +x ./flakybot
./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
69 changes: 69 additions & 0 deletions .github/workflows/vision.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: vision
on:
push:
branches:
- main
paths:
- 'vision/**'
pull_request:
paths:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add vision/productSearch/** to paths-ignore so changes to vision-productSearch don't trigger tests of vision.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where would I find the definition for this YAML schema? I've made the change to the YAML file but I don't think it's correct ....

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- 'vision/**'
- '!vision/productSearch/**'
pull_request_target:
types: [labeled]
paths:
- 'vision/**'
schedule:
- cron: '0 0 * * 0'
jobs:
test:
if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }}
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: 'write'
pull-requests: 'write'
id-token: 'write'
steps:
- uses: actions/checkout@v3.1.0
with:
ref: ${{github.event.pull_request.head.sha}}
- uses: 'google-github-actions/auth@v1.0.0'
with:
workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider'
service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com'
create_credentials_file: 'true'
access_token_lifetime: 600s
- uses: actions/setup-node@v3.5.1
with:
node-version: 16
- run: npm install
working-directory: vision
- run: npm test
working-directory: vision
env:
MOCHA_REPORTER_SUITENAME: vision
MOCHA_REPORTER_OUTPUT: vision_sponge_log.xml
MOCHA_REPORTER: xunit
- if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
await github.rest.issues.removeLabel({
name: 'actions:force-run',
owner: 'GoogleCloudPlatform',
repo: 'nodejs-docs-samples',
issue_number: context.payload.pull_request.number
});
} catch (e) {
if (!e.message.includes('Label does not exist')) {
throw e;
}
}
- if: ${{ github.event_name == 'schedule'}}
run: |
curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L
chmod +x ./flakybot
./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
2 changes: 2 additions & 0 deletions .github/workflows/workflows.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
"texttospeech",
"translate",
"video-intelligence",
"vision",
"vision/productSearch",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question 1: Should vision/productSearch actually be vision/samples/productSearch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're correct. Done.

"contact-center-insights",
"workflows"
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Praise: Thank you for sorting this in alphabetical order, Eric.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

4 changes: 4 additions & 0 deletions vision/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
rules:
no-console: off
node/no-unsupported-features/node-builtins: off
88 changes: 88 additions & 0 deletions vision/async-batch-annotate-images.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// Copyright 2019 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
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

function main(
inputImageUri = 'gs://cloud-samples-data/vision/label/wakeupcat.jpg',
outputUri = 'gs://YOUR_BUCKET_ID/path/to/save/results/'
) {
// [START vision_async_batch_annotate_images]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
// const inputImageUri = 'gs://cloud-samples-data/vision/label/wakeupcat.jpg';
// const outputUri = 'gs://YOUR_BUCKET_ID/path/to/save/results/';

// Imports the Google Cloud client libraries
const {ImageAnnotatorClient} = require('@google-cloud/vision').v1;

// Instantiates a client
const client = new ImageAnnotatorClient();

// You can send multiple images to be annotated, this sample demonstrates how to do this with
// one image. If you want to use multiple images, you have to create a request object for each image that you want annotated.
async function asyncBatchAnnotateImages() {
// Set the type of annotation you want to perform on the image
// https://cloud.google.com/vision/docs/reference/rpc/google.cloud.vision.v1#google.cloud.vision.v1.Feature.Type
const features = [{type: 'LABEL_DETECTION'}];

// Build the image request object for that one image. Note: for additional images you have to create
// additional image request objects and store them in a list to be used below.
const imageRequest = {
image: {
source: {
imageUri: inputImageUri,
},
},
features: features,
};

// Set where to store the results for the images that will be annotated.
const outputConfig = {
gcsDestination: {
uri: outputUri,
},
batchSize: 2, // The max number of responses to output in each JSON file
};

// Add each image request object to the batch request and add the output config.
const request = {
requests: [
imageRequest, // add additional request objects here
],
outputConfig,
};

// Make the asynchronous batch request.
const [operation] = await client.asyncBatchAnnotateImages(request);

// Wait for the operation to complete
const [filesResponse] = await operation.promise();

// The output is written to GCS with the provided output_uri as prefix
const destinationUri = filesResponse.outputConfig.gcsDestination.uri;
console.log(`Output written to GCS with prefix: ${destinationUri}`);
}

asyncBatchAnnotateImages();
// [END vision_async_batch_annotate_images]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});

main(...process.argv.slice(2));
108 changes: 108 additions & 0 deletions vision/batch-annotate-files-gcs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
// Copyright 2019 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
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

function main(
gcsSourceUri = 'gs://cloud-samples-data/vision/document_understanding/kafka.pdf'
) {
// [START vision_batch_annotate_files_gcs]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
// const gcsSourceUri = 'gs://cloud-samples-data/vision/document_understanding/kafka.pdf';

// Imports the Google Cloud client libraries
const {ImageAnnotatorClient} = require('@google-cloud/vision').v1;

// Instantiates a client
const client = new ImageAnnotatorClient();

// You can send multiple files to be annotated, this sample demonstrates how to do this with
// one file. If you want to use multiple files, you have to create a request object for each file that you want annotated.
async function batchAnnotateFiles() {
// First Specify the input config with the file's uri and its type.
// Supported mime_type: application/pdf, image/tiff, image/gif
// https://cloud.google.com/vision/docs/reference/rpc/google.cloud.vision.v1#inputconfig
const inputConfig = {
mimeType: 'application/pdf',
gcsSource: {
uri: gcsSourceUri,
},
};

// Set the type of annotation you want to perform on the file
// https://cloud.google.com/vision/docs/reference/rpc/google.cloud.vision.v1#google.cloud.vision.v1.Feature.Type
const features = [{type: 'DOCUMENT_TEXT_DETECTION'}];

// Build the request object for that one file. Note: for additional files you have to create
// additional file request objects and store them in a list to be used below.
// Since we are sending a file of type `application/pdf`, we can use the `pages` field to
// specify which pages to process. The service can process up to 5 pages per document file.
// https://cloud.google.com/vision/docs/reference/rpc/google.cloud.vision.v1#google.cloud.vision.v1.AnnotateFileRequest
const fileRequest = {
inputConfig: inputConfig,
features: features,
// Annotate the first two pages and the last one (max 5 pages)
// First page starts at 1, and not 0. Last page is -1.
pages: [1, 2, -1],
};

// Add each `AnnotateFileRequest` object to the batch request.
const request = {
requests: [fileRequest],
};

// Make the synchronous batch request.
const [result] = await client.batchAnnotateFiles(request);

// Process the results, just get the first result, since only one file was sent in this
// sample.
const responses = result.responses[0].responses;

for (const response of responses) {
console.log(`Full text: ${response.fullTextAnnotation.text}`);
for (const page of response.fullTextAnnotation.pages) {
for (const block of page.blocks) {
console.log(`Block confidence: ${block.confidence}`);
for (const paragraph of block.paragraphs) {
console.log(` Paragraph confidence: ${paragraph.confidence}`);
for (const word of paragraph.words) {
const symbol_texts = word.symbols.map(symbol => symbol.text);
const word_text = symbol_texts.join('');
console.log(
` Word text: ${word_text} (confidence: ${word.confidence})`
);
for (const symbol of word.symbols) {
console.log(
` Symbol: ${symbol.text} (confidence: ${symbol.confidence})`
);
}
}
}
}
}
}
}

batchAnnotateFiles();
// [END vision_batch_annotate_files_gcs]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});

main(...process.argv.slice(2));
Loading