不好:无法在 google 云语音中完成 "storage_client = storage.Client()"
Bad:Can't finish "storage_client = storage.Client()" in google cloud speech
谢谢你帮助我!
当我在Jupyter notebook中使用google云语音时,当我运行以下代码时发生错误:
import os
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = os.path.join(os.path.realpath('.'),'Lu/Lu-xxxxxxxxxx.json')
os.path.join(os.path.realpath('.'),'Lu/Lu-xxxxxxxxxx.json')
with open("Lu/Lu-xxxxxxxxxx.json") as f:
GOOGLE_CLOUD_SPEECH_CREDENTIALS = f.read()
def transcribe_gcs(gcs_uri):
from google.cloud import speech
...
client = speech.SpeechClient()
audio = ...
config = ...
operation = client.long_running_recognize(config, audio)
...
response = operation.result(timeout=90)
...
# Imports the Google Cloud Storage client library
from google.cloud import storage
# Instantiates a client()
storage_client = storage.Client()
阅读最后一行时,它表示DefaultCredentialsError:File /home/luffy/Lu/Lu-xxxxxxxxxx.json was not found.
但我确定 .json 在那里。是不是我的项目鉴权配置有问题?
看着这些问题,我觉得自己缺乏一些基础知识。 google云语音和python等的关系我不是很懂,哪里可以学?
谢谢!
原来可能是配置问题。我没有很好地完成 google 云的所有 'setting up environment' 过程。对于这部分quickstart for ubuntu and Debian,我把项目改成了我现在正在做的项目(我之前在google云上改过我的项目,但是没有按照这个网站来改我的项目).我为我的本地项目文件夹设置了 'virtualenv' 环境。经过这些步骤,我成功了!
谢谢你帮助我! 当我在Jupyter notebook中使用google云语音时,当我运行以下代码时发生错误:
import os
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = os.path.join(os.path.realpath('.'),'Lu/Lu-xxxxxxxxxx.json')
os.path.join(os.path.realpath('.'),'Lu/Lu-xxxxxxxxxx.json')
with open("Lu/Lu-xxxxxxxxxx.json") as f:
GOOGLE_CLOUD_SPEECH_CREDENTIALS = f.read()
def transcribe_gcs(gcs_uri):
from google.cloud import speech
...
client = speech.SpeechClient()
audio = ...
config = ...
operation = client.long_running_recognize(config, audio)
...
response = operation.result(timeout=90)
...
# Imports the Google Cloud Storage client library
from google.cloud import storage
# Instantiates a client()
storage_client = storage.Client()
阅读最后一行时,它表示DefaultCredentialsError:File /home/luffy/Lu/Lu-xxxxxxxxxx.json was not found.
但我确定 .json 在那里。是不是我的项目鉴权配置有问题?
看着这些问题,我觉得自己缺乏一些基础知识。 google云语音和python等的关系我不是很懂,哪里可以学?
谢谢!
原来可能是配置问题。我没有很好地完成 google 云的所有 'setting up environment' 过程。对于这部分quickstart for ubuntu and Debian,我把项目改成了我现在正在做的项目(我之前在google云上改过我的项目,但是没有按照这个网站来改我的项目).我为我的本地项目文件夹设置了 'virtualenv' 环境。经过这些步骤,我成功了!