第一次提交:阿龙电竞 Django 后端最新版本
This commit is contained in:
@@ -0,0 +1,141 @@
|
||||
# -*- 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.bda.v20200324 import models
|
||||
|
||||
|
||||
class BdaClient(AbstractClient):
|
||||
_apiVersion = '2020-03-24'
|
||||
_endpoint = 'bda.tencentcloudapi.com'
|
||||
_service = 'bda'
|
||||
|
||||
|
||||
def CreateSegmentationTask(self, request):
|
||||
r"""本接口为人像分割在线处理接口组中的提交任务接口,可以对提交的资源进行处理视频流/图片流识别视频作品中的人像区域,进行一键抠像、背景替换、人像虚化等后期处理。
|
||||
|
||||
:param request: Request instance for CreateSegmentationTask.
|
||||
:type request: :class:`tencentcloud.bda.v20200324.models.CreateSegmentationTaskRequest`
|
||||
:rtype: :class:`tencentcloud.bda.v20200324.models.CreateSegmentationTaskResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("CreateSegmentationTask", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.CreateSegmentationTaskResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def DescribeSegmentationTask(self, request):
|
||||
r"""可以查看单条任务的处理情况,包括处理状态,处理结果。
|
||||
|
||||
:param request: Request instance for DescribeSegmentationTask.
|
||||
:type request: :class:`tencentcloud.bda.v20200324.models.DescribeSegmentationTaskRequest`
|
||||
:rtype: :class:`tencentcloud.bda.v20200324.models.DescribeSegmentationTaskResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("DescribeSegmentationTask", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.DescribeSegmentationTaskResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def SegmentCustomizedPortraitPic(self, request):
|
||||
r"""在前后景分割的基础上优化多分类分割,支持对头发、五官等的分割,既作为换发型、挂件等底层技术,也可用于抠人头、抠人脸等玩法
|
||||
|
||||
:param request: Request instance for SegmentCustomizedPortraitPic.
|
||||
:type request: :class:`tencentcloud.bda.v20200324.models.SegmentCustomizedPortraitPicRequest`
|
||||
:rtype: :class:`tencentcloud.bda.v20200324.models.SegmentCustomizedPortraitPicResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("SegmentCustomizedPortraitPic", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.SegmentCustomizedPortraitPicResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def SegmentPortraitPic(self, request):
|
||||
r"""即二分类人像分割,识别传入图片中人体的完整轮廓,进行抠像。
|
||||
|
||||
:param request: Request instance for SegmentPortraitPic.
|
||||
:type request: :class:`tencentcloud.bda.v20200324.models.SegmentPortraitPicRequest`
|
||||
:rtype: :class:`tencentcloud.bda.v20200324.models.SegmentPortraitPicResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("SegmentPortraitPic", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.SegmentPortraitPicResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def TerminateSegmentationTask(self, request):
|
||||
r"""终止指定视频人像分割处理任务
|
||||
|
||||
:param request: Request instance for TerminateSegmentationTask.
|
||||
:type request: :class:`tencentcloud.bda.v20200324.models.TerminateSegmentationTaskRequest`
|
||||
:rtype: :class:`tencentcloud.bda.v20200324.models.TerminateSegmentationTaskResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("TerminateSegmentationTask", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.TerminateSegmentationTaskResponse()
|
||||
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,116 @@
|
||||
# -*- 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.bda.v20200324 import models
|
||||
from typing import Dict
|
||||
|
||||
|
||||
class BdaClient(AbstractClient):
|
||||
_apiVersion = '2020-03-24'
|
||||
_endpoint = 'bda.tencentcloudapi.com'
|
||||
_service = 'bda'
|
||||
|
||||
async def CreateSegmentationTask(
|
||||
self,
|
||||
request: models.CreateSegmentationTaskRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.CreateSegmentationTaskResponse:
|
||||
"""
|
||||
本接口为人像分割在线处理接口组中的提交任务接口,可以对提交的资源进行处理视频流/图片流识别视频作品中的人像区域,进行一键抠像、背景替换、人像虚化等后期处理。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "CreateSegmentationTask"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.CreateSegmentationTaskResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def DescribeSegmentationTask(
|
||||
self,
|
||||
request: models.DescribeSegmentationTaskRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.DescribeSegmentationTaskResponse:
|
||||
"""
|
||||
可以查看单条任务的处理情况,包括处理状态,处理结果。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "DescribeSegmentationTask"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.DescribeSegmentationTaskResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def SegmentCustomizedPortraitPic(
|
||||
self,
|
||||
request: models.SegmentCustomizedPortraitPicRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.SegmentCustomizedPortraitPicResponse:
|
||||
"""
|
||||
在前后景分割的基础上优化多分类分割,支持对头发、五官等的分割,既作为换发型、挂件等底层技术,也可用于抠人头、抠人脸等玩法
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "SegmentCustomizedPortraitPic"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.SegmentCustomizedPortraitPicResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def SegmentPortraitPic(
|
||||
self,
|
||||
request: models.SegmentPortraitPicRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.SegmentPortraitPicResponse:
|
||||
"""
|
||||
即二分类人像分割,识别传入图片中人体的完整轮廓,进行抠像。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "SegmentPortraitPic"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.SegmentPortraitPicResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def TerminateSegmentationTask(
|
||||
self,
|
||||
request: models.TerminateSegmentationTaskRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.TerminateSegmentationTaskResponse:
|
||||
"""
|
||||
终止指定视频人像分割处理任务
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "TerminateSegmentationTask"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.TerminateSegmentationTaskResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
@@ -0,0 +1,120 @@
|
||||
# -*- 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_AUDIODECODEFAILED = 'FailedOperation.AudioDecodeFailed'
|
||||
|
||||
# 音频编码失败。
|
||||
FAILEDOPERATION_AUDIOENCODEFAILED = 'FailedOperation.AudioEncodeFailed'
|
||||
|
||||
# 余额不足,开通失败,请充值后再开通。
|
||||
FAILEDOPERATION_BALANCEINSUFFICIENT = 'FailedOperation.BalanceInsufficient'
|
||||
|
||||
# 文件下载失败。
|
||||
FAILEDOPERATION_DOWNLOADERROR = 'FailedOperation.DownloadError'
|
||||
|
||||
# 图片解码失败。
|
||||
FAILEDOPERATION_IMAGEDECODEFAILED = 'FailedOperation.ImageDecodeFailed'
|
||||
|
||||
# 图片下载错误。
|
||||
FAILEDOPERATION_IMAGEDOWNLOADERROR = 'FailedOperation.ImageDownloadError'
|
||||
|
||||
# 人脸检测失败。
|
||||
FAILEDOPERATION_IMAGEFACEDETECTFAILED = 'FailedOperation.ImageFacedetectFailed'
|
||||
|
||||
# 图片不存在前景。
|
||||
FAILEDOPERATION_IMAGENOTFOREGROUND = 'FailedOperation.ImageNotForeground'
|
||||
|
||||
# 不支持的图片文件。
|
||||
FAILEDOPERATION_IMAGENOTSUPPORTED = 'FailedOperation.ImageNotSupported'
|
||||
|
||||
# 图片分辨率过大。
|
||||
FAILEDOPERATION_IMAGERESOLUTIONEXCEED = 'FailedOperation.ImageResolutionExceed'
|
||||
|
||||
# 图片分辨率过小。
|
||||
FAILEDOPERATION_IMAGERESOLUTIONINSUFFICIENT = 'FailedOperation.ImageResolutionInsufficient'
|
||||
|
||||
# base64编码后的图片数据过大。
|
||||
FAILEDOPERATION_IMAGESIZEEXCEED = 'FailedOperation.ImageSizeExceed'
|
||||
|
||||
# 服务内部错误,请重试。
|
||||
FAILEDOPERATION_INNERERROR = 'FailedOperation.InnerError'
|
||||
|
||||
# 任务冲突。
|
||||
FAILEDOPERATION_JOBCONFLICT = 'FailedOperation.JobConflict'
|
||||
|
||||
# 任务队列已满。
|
||||
FAILEDOPERATION_JOBQUEUEFULL = 'FailedOperation.JobQueueFull'
|
||||
|
||||
# 人像数过多。
|
||||
FAILEDOPERATION_PROFILENUMEXCEED = 'FailedOperation.ProfileNumExceed'
|
||||
|
||||
# 整个请求体太大(通常主要是图片)。
|
||||
FAILEDOPERATION_REQUESTENTITYTOOLARGE = 'FailedOperation.RequestEntityTooLarge'
|
||||
|
||||
# 后端服务超时。
|
||||
FAILEDOPERATION_REQUESTTIMEOUT = 'FailedOperation.RequestTimeout'
|
||||
|
||||
# RPC请求失败,一般为算法微服务故障。
|
||||
FAILEDOPERATION_RPCFAIL = 'FailedOperation.RpcFail'
|
||||
|
||||
# 人像分割失败。
|
||||
FAILEDOPERATION_SEGMENTFAILED = 'FailedOperation.SegmentFailed'
|
||||
|
||||
# 算法服务异常,请重试。
|
||||
FAILEDOPERATION_SERVERERROR = 'FailedOperation.ServerError'
|
||||
|
||||
# 任务超过上限。
|
||||
FAILEDOPERATION_TASKLIMITEXCEEDED = 'FailedOperation.TaskLimitExceeded'
|
||||
|
||||
# 任务不存在。
|
||||
FAILEDOPERATION_TASKNOTEXIST = 'FailedOperation.TaskNotExist'
|
||||
|
||||
# 任务取消失败。
|
||||
FAILEDOPERATION_TERMINATETASKFAILED = 'FailedOperation.TerminateTaskFailed'
|
||||
|
||||
# 文件太大。
|
||||
FAILEDOPERATION_TOOLARGEFILEERROR = 'FailedOperation.TooLargeFileError'
|
||||
|
||||
# 内部错误。
|
||||
FAILEDOPERATION_UNKNOWERROR = 'FailedOperation.UnKnowError'
|
||||
|
||||
# 视频解码失败。
|
||||
FAILEDOPERATION_VIDEODECODEFAILED = 'FailedOperation.VideoDecodeFailed'
|
||||
|
||||
# 参数不合法。
|
||||
INVALIDPARAMETER_INVALIDPARAMETER = 'InvalidParameter.InvalidParameter'
|
||||
|
||||
# 图片为空。
|
||||
INVALIDPARAMETERVALUE_IMAGEEMPTY = 'InvalidParameterValue.ImageEmpty'
|
||||
|
||||
# 图片中没有人脸。
|
||||
INVALIDPARAMETERVALUE_NOFACEINPHOTO = 'InvalidParameterValue.NoFaceInPhoto'
|
||||
|
||||
# URL格式不合法。
|
||||
INVALIDPARAMETERVALUE_URLILLEGAL = 'InvalidParameterValue.UrlIllegal'
|
||||
|
||||
# 文件太大。
|
||||
LIMITEXCEEDED_TOOLARGEFILEERROR = 'LimitExceeded.TooLargeFileError'
|
||||
|
||||
# 账号已欠费。
|
||||
RESOURCEUNAVAILABLE_INARREARS = 'ResourceUnavailable.InArrears'
|
||||
|
||||
# 计费状态未知,请确认是否已在控制台开通服务。
|
||||
RESOURCEUNAVAILABLE_NOTEXIST = 'ResourceUnavailable.NotExist'
|
||||
|
||||
# 未知方法名。
|
||||
UNSUPPORTEDOPERATION_UNKNOWMETHOD = 'UnsupportedOperation.UnknowMethod'
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user