第一次提交:阿龙电竞 Django 后端最新版本
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
# -*- coding: utf8 -*-
|
||||
# Copyright (c) 2017-2025 Tencent. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
# 操作失败。
|
||||
FAILEDOPERATION = 'FailedOperation'
|
||||
|
||||
# 图片下载出错
|
||||
FAILEDOPERATION_DOWNLOADERR = 'FailedOperation.DownloadErr'
|
||||
|
||||
# 用户区域与请求服务区域不一致。
|
||||
FAILEDOPERATION_ERRORUSERAREA = 'FailedOperation.ErrorUserArea'
|
||||
|
||||
# 数据插入错误。
|
||||
FAILEDOPERATION_INSERTERR = 'FailedOperation.InsertErr'
|
||||
|
||||
# 暂时无法识别该语种。
|
||||
FAILEDOPERATION_LANGUAGERECOGNITIONERR = 'FailedOperation.LanguageRecognitionErr'
|
||||
|
||||
# 本月免费额度已用完,如需继续使用您可以在机器翻译控制台升级为付费使用。
|
||||
FAILEDOPERATION_NOFREEAMOUNT = 'FailedOperation.NoFreeAmount'
|
||||
|
||||
# 内部请求错误,请稍后重试。
|
||||
FAILEDOPERATION_REQUESTAILABERR = 'FailedOperation.RequestAiLabErr'
|
||||
|
||||
# 账号因为欠费停止服务,请在腾讯云账户充值。
|
||||
FAILEDOPERATION_SERVICEISOLATE = 'FailedOperation.ServiceIsolate'
|
||||
|
||||
# 账号已停服。
|
||||
FAILEDOPERATION_STOPUSING = 'FailedOperation.StopUsing'
|
||||
|
||||
# 当日提交任务数达到上限
|
||||
FAILEDOPERATION_SUBMISSIONLIMITREACHED = 'FailedOperation.SubmissionLimitReached'
|
||||
|
||||
# 过多未完成任务
|
||||
FAILEDOPERATION_TOOMANYWAITPROCESS = 'FailedOperation.TooManyWaitProcess'
|
||||
|
||||
# 本月免费额度已用完,如需继续使用您可以在机器翻译控制台购买资源包或开通后付费使用。
|
||||
FAILEDOPERATION_USERHASNOFREEAMOUNT = 'FailedOperation.UserHasNoFreeAmount'
|
||||
|
||||
# 服务未开通,请在腾讯云官网机器翻译控制台开通服务。
|
||||
FAILEDOPERATION_USERNOTREGISTERED = 'FailedOperation.UserNotRegistered'
|
||||
|
||||
# 内部错误。
|
||||
INTERNALERROR = 'InternalError'
|
||||
|
||||
# 后台服务超时,请稍后重试。
|
||||
INTERNALERROR_BACKENDTIMEOUT = 'InternalError.BackendTimeout'
|
||||
|
||||
# 路由获取错误。
|
||||
INTERNALERROR_ERRORGETROUTE = 'InternalError.ErrorGetRoute'
|
||||
|
||||
# 未知错误。
|
||||
INTERNALERROR_ERRORUNKNOWN = 'InternalError.ErrorUnknown'
|
||||
|
||||
# 请求失败。
|
||||
INTERNALERROR_REQUESTFAILED = 'InternalError.RequestFailed'
|
||||
|
||||
# 参数错误。
|
||||
INVALIDPARAMETER = 'InvalidParameter'
|
||||
|
||||
# 重复的SessionUuid和Seq组合。
|
||||
INVALIDPARAMETER_DUPLICATEDSESSIONIDANDSEQ = 'InvalidParameter.DuplicatedSessionIdAndSeq'
|
||||
|
||||
# 参数错误。
|
||||
INVALIDPARAMETER_MISSINGPARAMETER = 'InvalidParameter.MissingParameter'
|
||||
|
||||
# Seq之间的间隙请不要大于2000。
|
||||
INVALIDPARAMETER_SEQINTERVALTOOLARGE = 'InvalidParameter.SeqIntervalTooLarge'
|
||||
|
||||
# 参数取值错误。
|
||||
INVALIDPARAMETERVALUE = 'InvalidParameterValue'
|
||||
|
||||
# 超过配额限制。
|
||||
LIMITEXCEEDED = 'LimitExceeded'
|
||||
|
||||
# 超出请求频率。
|
||||
LIMITEXCEEDED_LIMITEDACCESSFREQUENCY = 'LimitExceeded.LimitedAccessFrequency'
|
||||
|
||||
# 缺少参数错误。
|
||||
MISSINGPARAMETER = 'MissingParameter'
|
||||
|
||||
# 超出UIN使用限额。
|
||||
REQUESTLIMITEXCEEDED_UINLIMITEXCEEDED = 'RequestLimitExceeded.UinLimitExceeded'
|
||||
|
||||
# 请填写正确的Action字段名称。
|
||||
UNAUTHORIZEDOPERATION_ACTIONNOTFOUND = 'UnauthorizedOperation.ActionNotFound'
|
||||
|
||||
# 操作不支持。
|
||||
UNSUPPORTEDOPERATION = 'UnsupportedOperation'
|
||||
|
||||
# 音频分片长度超过限制,请保证分片长度小于8s。
|
||||
UNSUPPORTEDOPERATION_AUDIODURATIONEXCEED = 'UnsupportedOperation.AudioDurationExceed'
|
||||
|
||||
# 单次请求text超过长度限制。
|
||||
UNSUPPORTEDOPERATION_TEXTTOOLONG = 'UnsupportedOperation.TextTooLong'
|
||||
|
||||
# 不支持的目标语言,请参照语言列表。
|
||||
UNSUPPORTEDOPERATION_UNSUPPORTEDTARGETLANGUAGE = 'UnsupportedOperation.UnSupportedTargetLanguage'
|
||||
|
||||
# 不支持的语言,请参照语言列表。
|
||||
UNSUPPORTEDOPERATION_UNSUPPORTEDLANGUAGE = 'UnsupportedOperation.UnsupportedLanguage'
|
||||
|
||||
# 不支持的源语言,请参照语言列表。
|
||||
UNSUPPORTEDOPERATION_UNSUPPORTEDSOURCELANGUAGE = 'UnsupportedOperation.UnsupportedSourceLanguage'
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,223 @@
|
||||
# -*- coding: utf8 -*-
|
||||
# Copyright (c) 2017-2025 Tencent. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import json
|
||||
|
||||
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
|
||||
from tencentcloud.common.abstract_client import AbstractClient
|
||||
from tencentcloud.tmt.v20180321 import models
|
||||
|
||||
|
||||
class TmtClient(AbstractClient):
|
||||
_apiVersion = '2018-03-21'
|
||||
_endpoint = 'tmt.tencentcloudapi.com'
|
||||
_service = 'tmt'
|
||||
|
||||
|
||||
def FileTranslate(self, request):
|
||||
r"""提交文档原文内容,输出任务ID, 支持原文为单一语种文档(如出现多语言文档,仅支持以选定的源语言相关内容翻译),文件格式有pdf、docx、pptx、xlsx,支持的文本格式有txt、xml、html、markdown、properties。任务翻译数据可保存7天,7天后不再返回任务数据。请注意保存。
|
||||
|
||||
:param request: Request instance for FileTranslate.
|
||||
:type request: :class:`tencentcloud.tmt.v20180321.models.FileTranslateRequest`
|
||||
:rtype: :class:`tencentcloud.tmt.v20180321.models.FileTranslateResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("FileTranslate", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.FileTranslateResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def GetFileTranslate(self, request):
|
||||
r"""在调用文档翻译请求接口后,有回调和轮询两种方式获取识别结果。
|
||||
•当采用回调方式时,翻译完成后会将结果通过 POST 请求的形式通知到用户在请求时填写的回调 URL,具体请参见[文件翻译回调说明](https://cloud.tencent.com/document/product/551/91138)。
|
||||
• 当采用轮询方式时,需要主动提交任务ID来轮询识别结果,共有任务成功、等待、执行中和失败四种结果,具体信息请参见参数说明。
|
||||
|
||||
:param request: Request instance for GetFileTranslate.
|
||||
:type request: :class:`tencentcloud.tmt.v20180321.models.GetFileTranslateRequest`
|
||||
:rtype: :class:`tencentcloud.tmt.v20180321.models.GetFileTranslateResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("GetFileTranslate", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.GetFileTranslateResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def ImageTranslate(self, request):
|
||||
r"""提供13种语言的图片翻译服务,可自动识别图片中的文本内容并翻译成目标语言,识别后的文本按行翻译,后续会提供可按段落翻译的版本。<br />
|
||||
提示:对于一般开发者,我们建议优先使用SDK接入简化开发。SDK使用介绍请直接查看 5. 开发者资源 部分。
|
||||
|
||||
:param request: Request instance for ImageTranslate.
|
||||
:type request: :class:`tencentcloud.tmt.v20180321.models.ImageTranslateRequest`
|
||||
:rtype: :class:`tencentcloud.tmt.v20180321.models.ImageTranslateResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("ImageTranslate", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.ImageTranslateResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def ImageTranslateLLM(self, request):
|
||||
r"""提供18种语言的图片翻译服务,可自动识别图片中的文本内容并翻译成目标语言,识别后的文本按行翻译,后续会提供可按段落翻译的版本。
|
||||
|
||||
- 输入图片格式:png、jpg、jpeg等常用图片格式,不支持gif动图。
|
||||
- 输出图片格式:jpg。
|
||||
|
||||
提示:对于一般开发者,我们建议优先使用SDK接入简化开发。SDK使用介绍请直接查看 5. 开发者资源 部分。
|
||||
|
||||
:param request: Request instance for ImageTranslateLLM.
|
||||
:type request: :class:`tencentcloud.tmt.v20180321.models.ImageTranslateLLMRequest`
|
||||
:rtype: :class:`tencentcloud.tmt.v20180321.models.ImageTranslateLLMResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("ImageTranslateLLM", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.ImageTranslateLLMResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def LanguageDetect(self, request):
|
||||
r"""可自动识别文本内容的语言种类,轻量高效,无需额外实现判断方式,使面向客户的服务体验更佳。 <br />
|
||||
提示:对于一般开发者,我们建议优先使用SDK接入简化开发。SDK使用介绍请直接查看 5. 开发者资源 部分。
|
||||
|
||||
:param request: Request instance for LanguageDetect.
|
||||
:type request: :class:`tencentcloud.tmt.v20180321.models.LanguageDetectRequest`
|
||||
:rtype: :class:`tencentcloud.tmt.v20180321.models.LanguageDetectResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("LanguageDetect", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.LanguageDetectResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def SpeechTranslate(self, request):
|
||||
r"""本接口提供上传音频,将音频进行语音识别并翻译成文本的服务,目前开放中英互译的语音翻译服务。
|
||||
待识别和翻译的音频文件可以是 pcm、mp3和speex 格式,其中支持流式传输的只有pcm格式,pcm采样率要求16kHz、位深16bit、单声道,音频内语音清晰。<br/>
|
||||
如果采用流式传输的方式,要求每个分片时长200ms~500ms;如果采用非流式的传输方式,要求音频时长不超过8s。注意最后一个分片的IsEnd参数设置为1。<br />
|
||||
提示:对于一般开发者,我们建议优先使用SDK接入简化开发。SDK使用介绍请直接查看 5. 开发者资源部分。
|
||||
|
||||
:param request: Request instance for SpeechTranslate.
|
||||
:type request: :class:`tencentcloud.tmt.v20180321.models.SpeechTranslateRequest`
|
||||
:rtype: :class:`tencentcloud.tmt.v20180321.models.SpeechTranslateResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("SpeechTranslate", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.SpeechTranslateResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def TextTranslate(self, request):
|
||||
r"""腾讯翻译为合作伙伴提供文本翻译、文档翻译、交互翻译、AI同传等多种机器翻译服务,具有toB多行业解决方案。作为WMT世界机器翻译大赛冠军,翻译准确度值得信赖,其中,交互翻译能力是业界领先技术;腾讯同传是AI同传业界标杆。<br />
|
||||
提示:对于一般开发者,我们建议优先使用SDK接入简化开发。SDK使用介绍请直接查看 5. 开发者资源 部分。
|
||||
|
||||
:param request: Request instance for TextTranslate.
|
||||
:type request: :class:`tencentcloud.tmt.v20180321.models.TextTranslateRequest`
|
||||
:rtype: :class:`tencentcloud.tmt.v20180321.models.TextTranslateResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("TextTranslate", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.TextTranslateResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def TextTranslateBatch(self, request):
|
||||
r"""批量翻译文本的接口
|
||||
|
||||
:param request: Request instance for TextTranslateBatch.
|
||||
:type request: :class:`tencentcloud.tmt.v20180321.models.TextTranslateBatchRequest`
|
||||
:rtype: :class:`tencentcloud.tmt.v20180321.models.TextTranslateBatchResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("TextTranslateBatch", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.TextTranslateBatchResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
@@ -0,0 +1,183 @@
|
||||
# -*- coding: utf8 -*-
|
||||
# Copyright (c) 2017-2025 Tencent. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
|
||||
from tencentcloud.common.abstract_client_async import AbstractClient
|
||||
from tencentcloud.tmt.v20180321 import models
|
||||
from typing import Dict
|
||||
|
||||
|
||||
class TmtClient(AbstractClient):
|
||||
_apiVersion = '2018-03-21'
|
||||
_endpoint = 'tmt.tencentcloudapi.com'
|
||||
_service = 'tmt'
|
||||
|
||||
async def FileTranslate(
|
||||
self,
|
||||
request: models.FileTranslateRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.FileTranslateResponse:
|
||||
"""
|
||||
提交文档原文内容,输出任务ID, 支持原文为单一语种文档(如出现多语言文档,仅支持以选定的源语言相关内容翻译),文件格式有pdf、docx、pptx、xlsx,支持的文本格式有txt、xml、html、markdown、properties。任务翻译数据可保存7天,7天后不再返回任务数据。请注意保存。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "FileTranslate"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.FileTranslateResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def GetFileTranslate(
|
||||
self,
|
||||
request: models.GetFileTranslateRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.GetFileTranslateResponse:
|
||||
"""
|
||||
在调用文档翻译请求接口后,有回调和轮询两种方式获取识别结果。
|
||||
•当采用回调方式时,翻译完成后会将结果通过 POST 请求的形式通知到用户在请求时填写的回调 URL,具体请参见[文件翻译回调说明](https://cloud.tencent.com/document/product/551/91138)。
|
||||
• 当采用轮询方式时,需要主动提交任务ID来轮询识别结果,共有任务成功、等待、执行中和失败四种结果,具体信息请参见参数说明。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "GetFileTranslate"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.GetFileTranslateResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def ImageTranslate(
|
||||
self,
|
||||
request: models.ImageTranslateRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.ImageTranslateResponse:
|
||||
"""
|
||||
提供13种语言的图片翻译服务,可自动识别图片中的文本内容并翻译成目标语言,识别后的文本按行翻译,后续会提供可按段落翻译的版本。<br />
|
||||
提示:对于一般开发者,我们建议优先使用SDK接入简化开发。SDK使用介绍请直接查看 5. 开发者资源 部分。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "ImageTranslate"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.ImageTranslateResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def ImageTranslateLLM(
|
||||
self,
|
||||
request: models.ImageTranslateLLMRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.ImageTranslateLLMResponse:
|
||||
"""
|
||||
提供18种语言的图片翻译服务,可自动识别图片中的文本内容并翻译成目标语言,识别后的文本按行翻译,后续会提供可按段落翻译的版本。
|
||||
|
||||
- 输入图片格式:png、jpg、jpeg等常用图片格式,不支持gif动图。
|
||||
- 输出图片格式:jpg。
|
||||
|
||||
提示:对于一般开发者,我们建议优先使用SDK接入简化开发。SDK使用介绍请直接查看 5. 开发者资源 部分。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "ImageTranslateLLM"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.ImageTranslateLLMResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def LanguageDetect(
|
||||
self,
|
||||
request: models.LanguageDetectRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.LanguageDetectResponse:
|
||||
"""
|
||||
可自动识别文本内容的语言种类,轻量高效,无需额外实现判断方式,使面向客户的服务体验更佳。 <br />
|
||||
提示:对于一般开发者,我们建议优先使用SDK接入简化开发。SDK使用介绍请直接查看 5. 开发者资源 部分。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "LanguageDetect"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.LanguageDetectResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def SpeechTranslate(
|
||||
self,
|
||||
request: models.SpeechTranslateRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.SpeechTranslateResponse:
|
||||
"""
|
||||
本接口提供上传音频,将音频进行语音识别并翻译成文本的服务,目前开放中英互译的语音翻译服务。
|
||||
待识别和翻译的音频文件可以是 pcm、mp3和speex 格式,其中支持流式传输的只有pcm格式,pcm采样率要求16kHz、位深16bit、单声道,音频内语音清晰。<br/>
|
||||
如果采用流式传输的方式,要求每个分片时长200ms~500ms;如果采用非流式的传输方式,要求音频时长不超过8s。注意最后一个分片的IsEnd参数设置为1。<br />
|
||||
提示:对于一般开发者,我们建议优先使用SDK接入简化开发。SDK使用介绍请直接查看 5. 开发者资源部分。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "SpeechTranslate"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.SpeechTranslateResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def TextTranslate(
|
||||
self,
|
||||
request: models.TextTranslateRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.TextTranslateResponse:
|
||||
"""
|
||||
腾讯翻译为合作伙伴提供文本翻译、文档翻译、交互翻译、AI同传等多种机器翻译服务,具有toB多行业解决方案。作为WMT世界机器翻译大赛冠军,翻译准确度值得信赖,其中,交互翻译能力是业界领先技术;腾讯同传是AI同传业界标杆。<br />
|
||||
提示:对于一般开发者,我们建议优先使用SDK接入简化开发。SDK使用介绍请直接查看 5. 开发者资源 部分。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "TextTranslate"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.TextTranslateResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def TextTranslateBatch(
|
||||
self,
|
||||
request: models.TextTranslateBatchRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.TextTranslateBatchResponse:
|
||||
"""
|
||||
批量翻译文本的接口
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "TextTranslateBatch"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.TextTranslateBatchResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
Reference in New Issue
Block a user