0
我正在嘗試使用Google Vision API。 我做了以下步驟:Google API Vision - 無法加載默認憑據
- 啓用了谷歌視覺API
- 創建服務帳戶ID
- 設置好的的是交流電varialbe 'GOOGLE_APPLICATION_CREDENTIALS' 與JSON路徑
- 下載的API與作曲家
寫下了以下代碼:
$vision = new VisionClient([ 'projectId' => $googleApiKey, ]);
$ image = $ vision-> image(file_get_contents($ path),['FACE_DETECTION']); $ result = $ vision-> annotate($ image);
當我的午餐這個代碼,我得到了以下錯誤:
Fatal error: Uncaught exception 'Google\Cloud\Core\Exception\ServiceException' with message 'Could not load the default credentials.
有人可以幫我解決這個問題呢?
非常感謝!