日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

快速開始

本文為您介紹如何快速調用靈積語音模型服務。

說明

若您有合作需求或技術咨詢,請提交工單

前提條件

示例代碼

以下示例展示了調用Paraformer語音識別文件轉寫API,對一個通過URL給出的音頻文件進行語音識別的代碼。

說明
  • 需要使用您的API-KEY替換示例中的your-dashscope-api-key,代碼才能正常運行。

  • 通過URL指定進行語音轉寫的文件,其大小不超過2GB。

  • file_urls參數支持傳入多個文件URL,示例中僅展示對一個文件URL進行轉寫。

# For prerequisites running the following sample, visit http://bestwisewords.com/document_detail/611472.html

import dashscope
from urllib import request
import json

dashscope.api_key='your-dashscope-api-key'

task_response=dashscope.audio.asr.Transcription.async_call(
    model='paraformer-v1',
    file_urls=['https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world.wav']
    )

transcription_response=dashscope.audio.asr.Transcription.wait(task=task_response.output.task_id)

transcription_url=transcription_response.output['results'][0]['transcription_url']
transcription_results=json.loads(request.urlopen(transcription_url).read().decode('utf8'))
print(json.dumps(transcription_results, indent=4, ensure_ascii=False))

調用成功后,將會返回例如以下示例的文件轉寫結果。

{
    "file_url": "https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world.wav",
    "properties": {
        "audio_format": "pcm_s16le",
        "channels": [
            0
        ],
        "original_sampling_rate": 16000,
        "original_duration": 4087
    },
    "transcripts": [
        {
            "channel_id": 0,
            "content_duration": 3840,
            "text": "Hello, world, 來自阿里巴巴達摩院語音實驗室。",
            "sentences": [
                {
                    "begin_time": 0,
                    "end_time": 3840,
                    "text": "Hello, world, 來自阿里巴巴達摩院語音實驗室。",
                    "words": [
                        {
                            "begin_time": 0,
                            "end_time": 540,
                            "text": "Hello",
                            "punctuation": ", "
                        },
                        {
                            "begin_time": 540,
                            "end_time": 1260,
                            "text": "world",
                            "punctuation": ", "
                        },
                        {
                            "begin_time": 1260,
                            "end_time": 1440,
                            "text": "來",
                            "punctuation": ""
                        },
                        {
                            "begin_time": 1440,
                            "end_time": 1660,
                            "text": "自",
                            "punctuation": ""
                        },
                        {
                            "begin_time": 1660,
                            "end_time": 1800,
                            "text": "阿",
                            "punctuation": ""
                        },
                        {
                            "begin_time": 1800,
                            "end_time": 2020,
                            "text": "里",
                            "punctuation": ""
                        },
                        {
                            "begin_time": 2020,
                            "end_time": 2200,
                            "text": "巴",
                            "punctuation": ""
                        },
                        {
                            "begin_time": 2200,
                            "end_time": 2400,
                            "text": "巴",
                            "punctuation": ""
                        },
                        {
                            "begin_time": 2400,
                            "end_time": 2580,
                            "text": "達",
                            "punctuation": ""
                        },
                        {
                            "begin_time": 2580,
                            "end_time": 2760,
                            "text": "摩",
                            "punctuation": ""
                        },
                        {
                            "begin_time": 2760,
                            "end_time": 3000,
                            "text": "院",
                            "punctuation": ""
                        },
                        {
                            "begin_time": 3000,
                            "end_time": 3180,
                            "text": "語",
                            "punctuation": ""
                        },
                        {
                            "begin_time": 3180,
                            "end_time": 3400,
                            "text": "音",
                            "punctuation": ""
                        },
                        {
                            "begin_time": 3400,
                            "end_time": 3580,
                            "text": "實",
                            "punctuation": ""
                        },
                        {
                            "begin_time": 3580,
                            "end_time": 3720,
                            "text": "驗",
                            "punctuation": ""
                        },
                        {
                            "begin_time": 3720,
                            "end_time": 3840,
                            "text": "室",
                            "punctuation": "。"
                        }
                    ]
                }
            ]
        }
    ]
}

了解更多

更多關于Paraformer語音識別的調用說明,請參見API詳情