This program labels emails in Gmail after analyzing attached images with Google Vision.
In order to use the program you need a GCP project with the following APIs enabled:
- Google Vision API
- GMail API
Service account with access for Google Vision set env. variable: GOOGLE_APPLICATION_CREDENTIALS.
Store the credentials for OAuth 2.0 client ID (for the GCP project) in file "src/main/resources/credentials.json"
The first time you run the program a web browser will open where you choose which Gmail account the program should get access to - this generates a token which is stored in "tokens".
mvn clean compile assembly:single
Resulting jar pops out in target/GmailImageAnalyzerAndLabeller.jar
- Set GOOGLE_APPLICATION_CREDENTIALS to the service account connected to your GCP project.
- $java -jar target/GmailImageAnalyzerAndLabeller.jar
- Fill out the Oauth prompt to grant the application (i.e. your GCP project) access to the gmail acount you want to use.
Finished! the program should run.
The stored credentials for the Gmail connection expires after 6 months.
Make sure tokens folder is in the same dir as current dir.
$java -jar GmailImageAnalyzerAndLabeller.jar
Stolen from https://en.wikipedia.org/wiki/List_of_animal_names