在Firebase CLI中激活Google Speech API? [英] Activating Google Speech API in Firebase CLI?
问题描述
当我尝试使用curl
从cmd命令行(Windows 10)或从本地Firebase服务器使用Google Speech时,出现此错误.
I get this error when I try to use Google Speech from either the cmd command line (Windows 10) using curl
or from a local Firebase server.
之前或之前,firefire-cli项目尚未使用Cloud Speech API 它被禁用.通过访问启用它 https://console.developers. google.com/apis/api/speech.googleapis.com/overview?project=firebase-cli 然后重试"
"Cloud Speech API has not been used in project firebase-cli before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/speech.googleapis.com/overview?project=firebase-cli then retry"
转到建议的URL只会显示以下消息:
Going to the suggested URL just gives the message:
API"speech.googleapis.com"不存在或您无权访问
The API "speech.googleapis.com" doesn't exist or you don't have permission to access it
curl
命令之前已经起作用.登录似乎可以正常工作(使用Bearer
标头).我不知道为什么现在不起作用.在此之前我做了什么工作吗?还是Firebase CLI/Google Speech有一些更改?
The curl
command has worked before. Login seems to work (using Bearer
header). I have no idea why it does not work now. Did I do something before that made it work? Or is there some change to Firebase CLI/Google Speech?
这是以前起作用的curl命令.我认为这并不重要,但仍然有人可能会对此感兴趣:
Here is the curl command that worked before. I do not think it matters here, but someone might be interested still:
@for /f %%i in ('gcloud auth application-default print-access-token') do @set bearer=%%i
curl -X POST ^
-H "Authorization: Bearer %bearer%" ^
-H "Content-Type: application/json; charset=utf-8" ^
--data @request-flac.json ^
"https://speech.googleapis.com/v1/speech:longrunningrecognize"
推荐答案
遵循 Cloud Speech API快速入门.有一个按钮可以帮助您在项目中启用API.如果您不想那样做:
Follow the Cloud Speech API quickstart. There is a button that will help you enable the API in your project. If you don't want to do it that way:
- 转到 GCP控制台
- 在左侧菜单中选择"API和服务"选项
- 选择仪表板
- 点击启用API和服务
- 在搜索框中输入语音"
- 点击语音API"卡
- 点击启用
- Go to the GCP console
- Select the APIs and Services option in the left menu
- Select dashboard
- Click Enable APIs and Services
- Type "speech" in the search box
- Click the "Speech API" card
- Click Enable
这是在项目中启用API的通用方法.
This is the generalized way to enable APIs in your project.
这篇关于在Firebase CLI中激活Google Speech API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!