пример кода:
Код: Выделить всё
public function speechToText($filepath, $fileName)
{
$audioFilePath = $filepath;
$response = $this->media->request('POST', 'audio/translations', [
'multipart' => [
[
'name' => 'model',
'contents' => 'whisper-1',
'timestamp_granularities' => 'word'
],
[
'name' => 'file',
'contents' => fopen($audioFilePath, 'r'),
'filename' => $fileName
]
]
]);
$data = json_decode($response->getBody()->getContents(), true);
return $data
}
как мне рассчитать токен для каждого перевода
Подробнее здесь: https://stackoverflow.com/questions/782 ... framewiork