文件

ASR_語音轉文字: offline 檔案上傳

Service: asr.api.yating.tw/v1

進行語音辨識或是客製化語言模型之前,你可以先用雅婷智慧的暫存服務上傳檔案。檔案上傳成功後,你會得到一個特殊的網址,只能用在語音轉文字相關服務上,你無法用其他方式下載檔案,並且連結會在上傳成功後的 24 小時內失效。


上傳檔案

Request
URL: /v1/uploads/
Method: POST
以下是 cURL 範例。

curl --location --request POST 'https://asr.api.yating.tw/v1/uploads' \
--header 'Key: your_key\
--form 'file=@"your_audio_file_Path"'

python script範例

import requests

fileName = "your_file_path"

headers = {'key': "your_key"}
files = {'file': open(fileNSame,'rb')}
response = requests.post('https://asr.api.yating.tw/v1/uploads',
                        headers=headers,
                        files=files)

print(response.json())

Response

{
  "fileName": "your_file_path",
  "url": "yd://67fa7103-5c66-4724-bd53-280e36f40c3f",
  "expiredAt": "2022-08-03T15:11:40.000Z"
}

列出已上傳的檔案

Request
URL: /v1/uploads/
Method: GET

Headers

Name Type Info
*key String Bearer {key}

Response

[
    {
        "fileName": "fileName1",
        "url": "yd://happy-121d94db.mp3",
        "expiredAt": "2022-08-03T15:11:40.000Z"
    },
    {
        "fileName": "fileName2",
        "url": "yd://happy-4f3598be.mp3",
        "expiredAt": "2022-08-03T15:11:40.000Z"
    },
    {
        "fileName": "fileName3",
        "url": "yd://rfc4180-691be6.txt",
        "expiredAt": "2022-08-03T15:11:40.000Z"
    }
]