【问题标题】:service exception error 60 when trying to run google cloud speech transcription尝试运行谷歌云语音转录时服务异常错误 60
【发布时间】:2018-09-26 19:02:49
【问题描述】:

我对这一切都不熟悉,所以请保持温和。我知道基本的 php 并在我的计算机上安装了 WAMP。我所需要的只是一种转录音频文件的简单方法。我安装了 google cloud shell sdk,并使用它来让 composer 安装所需的文件(复制并粘贴来自 google 教程的命令),并将其放入供应商文件夹中。

然后我修改了谷歌放在 github 上的 php 代码,我将在下面粘贴。但是,当我尝试运行 php 文件时,我收到以下错误消息。我究竟做错了什么? :(

<?php

# [START speech_quickstart]
# Includes the autoloader for libraries installed with composer
require __DIR__ . '/vendor/autoload.php';


# Imports the Google Cloud client library
use Google\Cloud\Speech\SpeechClient;


# Your Google Cloud Platform project ID
$projectId = 'xxxx';


# Instantiates a client
$speech = new SpeechClient([
    'projectId' => $projectId,
    'languageCode' => 'en-US',
]);


# The name of the audio file to transcribe
$fileName = __DIR__ . '/audio/transcribe.mp3';


# The audio file's encoding and sample rate
$options = [
    'encoding' => 'LINEAR16',
    'sampleRateHertz' => 16000,
    'languageCode' => 'en-US',
    'enableWordTimeOffsets' => false,
    'enableAutomaticPunctuation' => true,
    'model' => 'video',
];


# Detects speech in the audio file
$results = $speech->recognize(fopen($fileName, 'r'), $options);
foreach ($results as $result) {
    echo 'Transcription: ' . $result->alternatives()[0]['transcript'] . PHP_EOL;
}


# [END speech_quickstart]
return $results;

【问题讨论】:

  • 请在您的问题文本中包含minimal reproducible example 和错误消息。
  • 这是最小的,因为所有这些都是获取错误消息所必需的。但是,我不知道如何复制它,因为我假设问题出在设置中。

标签: php google-cloud-platform google-speech-api


【解决方案1】:

错误消息表明 cURL 没有可用的证书颁发机构的证书列表,因此无法验证与 Google 的连接的完整性。 this answer 中的步骤应该可以解决问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-14
    • 1970-01-01
    • 2018-07-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多