This tutorial will guide you through setting up the Google Cloud Vision API.
-
Go to the Google Cloud Console.
- Open your web browser and navigate to the Google Cloud Console.
-
Create a New Project.
- Click on the project dropdown at the top of the page.
- Select "New Project" and fill in the details.
- Click "Create".
-
Open the API Library.
- In the Cloud Console, go to the "APIs & Services" > "Library".
-
Search for the Vision API.
- Type "Vision" in the search bar and select "Cloud Vision API".
-
Enable the API.
- Click the "Enable" button.
-
Create a Service Account.
- Navigate to "IAM & Admin" > "Service accounts".
- Click "Create Service Account".
- Fill in the details and click "Create".
-
Assign Roles.
- Assign the necessary roles (e.g., "Viewer", "Editor") and click "Continue".
-
Generate and Download the Key.
- Click on the created service account.
- Go to the "Keys" tab and click "Add Key" > "Create new key".
- Choose "JSON" and click "Create". The key file will download automatically.
- Set
GOOGLE_APPLICATION_CREDENTIALS
.- On your local machine, set the environment variable to point to the downloaded JSON key file.
- For example, in a Linux or macOS terminal, you can use:
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/keyfile.json"
That's it! You've successfully set up the Google Cloud Vision API.