huaweicloud-sdk-python-v3/huaweicloud-sdk-moderation/huaweicloudsdkmoderation/v3/model/image_detection_req.py

286 lines
10 KiB
Python
Raw Normal View History

2022-09-22 11:38:02 +00:00
# coding: utf-8
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class ImageDetectionReq:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
sensitive_list = []
openapi_types = {
'event_type': 'str',
'categories': 'list[str]',
'image_text_config': 'ImgTextConfig',
'url': 'str',
2023-09-14 09:28:03 +00:00
'image': 'str',
2023-11-09 09:11:11 +00:00
'biz_type': 'str',
'language': 'str'
2022-09-22 11:38:02 +00:00
}
attribute_map = {
'event_type': 'event_type',
'categories': 'categories',
'image_text_config': 'image_text_config',
'url': 'url',
2023-09-14 09:28:03 +00:00
'image': 'image',
2023-11-09 09:11:11 +00:00
'biz_type': 'biz_type',
'language': 'language'
2022-09-22 11:38:02 +00:00
}
2023-11-09 09:11:11 +00:00
def __init__(self, event_type=None, categories=None, image_text_config=None, url=None, image=None, biz_type=None, language=None):
2022-09-22 11:38:02 +00:00
"""ImageDetectionReq
The model defined in huaweicloud sdk
:param event_type: 事件类型 可选值如下 head_image头像 album相册 dynamic动态 article帖子 comment评论 room_cover房间封面 group_message群聊图片 message私聊图片 product商品图片
:type event_type: str
2022-11-17 12:13:53 +00:00
:param categories: 检测场景可添加的检测场景如下 - terrorism暴恐元素的检测 - porn涉黄元素的检测 - image_text广告图文的检测 - 可通过配置上述场景来完对应场景元素的检测 > 每个检测场景的检测次数会分类统计
2022-09-22 11:38:02 +00:00
:type categories: list[str]
:param image_text_config:
:type image_text_config: :class:`huaweicloudsdkmoderation.v3.ImgTextConfig`
2022-11-17 12:13:53 +00:00
:param url: 图片url, 与image二选一目前支持 - 公网HTTP/HTTPS URL
2022-09-22 11:38:02 +00:00
:type url: str
2022-11-17 12:13:53 +00:00
:param image: 与url二选一图片文件Base64编码字符串要求base64编码后大小不超过10M支持JPG/PNG/JPEG/WEBP/GIF/TIFF/TIF/HEIF等格式
2022-09-22 11:38:02 +00:00
:type image: str
2023-09-14 09:28:03 +00:00
:param biz_type: 自定义审核策略名称可在控制台配置;如果请求参数中传了biz_type则优先使用biz_type,如果用户没传biz_type则event_type和categories必须传
:type biz_type: str
2023-11-09 09:11:11 +00:00
:param language: 可指定图片中文字语种类型
:type language: str
2022-09-22 11:38:02 +00:00
"""
self._event_type = None
self._categories = None
self._image_text_config = None
self._url = None
self._image = None
2023-09-14 09:28:03 +00:00
self._biz_type = None
2023-11-09 09:11:11 +00:00
self._language = None
2022-09-22 11:38:02 +00:00
self.discriminator = None
2023-09-14 09:28:03 +00:00
if event_type is not None:
self.event_type = event_type
if categories is not None:
self.categories = categories
2022-09-22 11:38:02 +00:00
if image_text_config is not None:
self.image_text_config = image_text_config
if url is not None:
self.url = url
if image is not None:
self.image = image
2023-09-14 09:28:03 +00:00
if biz_type is not None:
self.biz_type = biz_type
2023-11-09 09:11:11 +00:00
if language is not None:
self.language = language
2022-09-22 11:38:02 +00:00
@property
def event_type(self):
"""Gets the event_type of this ImageDetectionReq.
事件类型 可选值如下 head_image头像 album相册 dynamic动态 article帖子 comment评论 room_cover房间封面 group_message群聊图片 message私聊图片 product商品图片
:return: The event_type of this ImageDetectionReq.
:rtype: str
"""
return self._event_type
@event_type.setter
def event_type(self, event_type):
"""Sets the event_type of this ImageDetectionReq.
事件类型 可选值如下 head_image头像 album相册 dynamic动态 article帖子 comment评论 room_cover房间封面 group_message群聊图片 message私聊图片 product商品图片
:param event_type: The event_type of this ImageDetectionReq.
:type event_type: str
"""
self._event_type = event_type
@property
def categories(self):
"""Gets the categories of this ImageDetectionReq.
2022-11-17 12:13:53 +00:00
检测场景可添加的检测场景如下 - terrorism暴恐元素的检测 - porn涉黄元素的检测 - image_text广告图文的检测 - 可通过配置上述场景来完对应场景元素的检测 > 每个检测场景的检测次数会分类统计
2022-09-22 11:38:02 +00:00
:return: The categories of this ImageDetectionReq.
:rtype: list[str]
"""
return self._categories
@categories.setter
def categories(self, categories):
"""Sets the categories of this ImageDetectionReq.
2022-11-17 12:13:53 +00:00
检测场景可添加的检测场景如下 - terrorism暴恐元素的检测 - porn涉黄元素的检测 - image_text广告图文的检测 - 可通过配置上述场景来完对应场景元素的检测 > 每个检测场景的检测次数会分类统计
2022-09-22 11:38:02 +00:00
:param categories: The categories of this ImageDetectionReq.
:type categories: list[str]
"""
self._categories = categories
@property
def image_text_config(self):
"""Gets the image_text_config of this ImageDetectionReq.
:return: The image_text_config of this ImageDetectionReq.
:rtype: :class:`huaweicloudsdkmoderation.v3.ImgTextConfig`
"""
return self._image_text_config
@image_text_config.setter
def image_text_config(self, image_text_config):
"""Sets the image_text_config of this ImageDetectionReq.
:param image_text_config: The image_text_config of this ImageDetectionReq.
:type image_text_config: :class:`huaweicloudsdkmoderation.v3.ImgTextConfig`
"""
self._image_text_config = image_text_config
@property
def url(self):
"""Gets the url of this ImageDetectionReq.
2022-11-17 12:13:53 +00:00
图片url, 与image二选一目前支持 - 公网HTTP/HTTPS URL
2022-09-22 11:38:02 +00:00
:return: The url of this ImageDetectionReq.
:rtype: str
"""
return self._url
@url.setter
def url(self, url):
"""Sets the url of this ImageDetectionReq.
2022-11-17 12:13:53 +00:00
图片url, 与image二选一目前支持 - 公网HTTP/HTTPS URL
2022-09-22 11:38:02 +00:00
:param url: The url of this ImageDetectionReq.
:type url: str
"""
self._url = url
@property
def image(self):
"""Gets the image of this ImageDetectionReq.
2022-11-17 12:13:53 +00:00
与url二选一图片文件Base64编码字符串要求base64编码后大小不超过10M支持JPG/PNG/JPEG/WEBP/GIF/TIFF/TIF/HEIF等格式
2022-09-22 11:38:02 +00:00
:return: The image of this ImageDetectionReq.
:rtype: str
"""
return self._image
@image.setter
def image(self, image):
"""Sets the image of this ImageDetectionReq.
2022-11-17 12:13:53 +00:00
与url二选一图片文件Base64编码字符串要求base64编码后大小不超过10M支持JPG/PNG/JPEG/WEBP/GIF/TIFF/TIF/HEIF等格式
2022-09-22 11:38:02 +00:00
:param image: The image of this ImageDetectionReq.
:type image: str
"""
self._image = image
2023-09-14 09:28:03 +00:00
@property
def biz_type(self):
"""Gets the biz_type of this ImageDetectionReq.
自定义审核策略名称可在控制台配置;如果请求参数中传了biz_type则优先使用biz_type,如果用户没传biz_type则event_type和categories必须传
:return: The biz_type of this ImageDetectionReq.
:rtype: str
"""
return self._biz_type
@biz_type.setter
def biz_type(self, biz_type):
"""Sets the biz_type of this ImageDetectionReq.
自定义审核策略名称可在控制台配置;如果请求参数中传了biz_type则优先使用biz_type,如果用户没传biz_type则event_type和categories必须传
:param biz_type: The biz_type of this ImageDetectionReq.
:type biz_type: str
"""
self._biz_type = biz_type
2023-11-09 09:11:11 +00:00
@property
def language(self):
"""Gets the language of this ImageDetectionReq.
可指定图片中文字语种类型
:return: The language of this ImageDetectionReq.
:rtype: str
"""
return self._language
@language.setter
def language(self, language):
"""Sets the language of this ImageDetectionReq.
可指定图片中文字语种类型
:param language: The language of this ImageDetectionReq.
:type language: str
"""
self._language = language
2022-09-22 11:38:02 +00:00
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
if attr in self.sensitive_list:
result[attr] = "****"
else:
result[attr] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
import simplejson as json
if six.PY2:
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
return json.dumps(sanitize_for_serialization(self), ensure_ascii=False)
def __repr__(self):
"""For `print`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, ImageDetectionReq):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other