intellif-aihub 0.1.5__py3-none-any.whl → 0.1.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of intellif-aihub might be problematic. Click here for more details.
- aihub/__init__.py +1 -1
- aihub/client.py +35 -12
- aihub/models/data_warehouse.py +95 -0
- aihub/models/dataset_management.py +99 -61
- aihub/models/document_center.py +26 -18
- aihub/models/eval.py +20 -11
- aihub/models/labelfree.py +12 -38
- aihub/models/model_center.py +141 -0
- aihub/models/model_training_platform.py +183 -149
- aihub/models/quota_schedule_management.py +201 -150
- aihub/models/tag_resource_management.py +30 -24
- aihub/models/task_center.py +39 -36
- aihub/models/user_system.py +159 -125
- aihub/models/workflow_center.py +461 -0
- aihub/services/artifact.py +22 -15
- aihub/services/data_warehouse.py +97 -0
- aihub/services/dataset_management.py +142 -23
- aihub/services/document_center.py +24 -5
- aihub/services/eval.py +14 -7
- aihub/services/labelfree.py +11 -0
- aihub/services/model_center.py +183 -0
- aihub/services/model_training_platform.py +99 -29
- aihub/services/quota_schedule_management.py +104 -7
- aihub/services/tag_resource_management.py +33 -2
- aihub/services/task_center.py +23 -9
- aihub/services/user_system.py +237 -2
- aihub/services/workflow_center.py +522 -0
- aihub/utils/download.py +19 -3
- {intellif_aihub-0.1.5.dist-info → intellif_aihub-0.1.6.dist-info}/METADATA +3 -3
- intellif_aihub-0.1.6.dist-info/RECORD +42 -0
- intellif_aihub-0.1.5.dist-info/RECORD +0 -36
- {intellif_aihub-0.1.5.dist-info → intellif_aihub-0.1.6.dist-info}/WHEEL +0 -0
- {intellif_aihub-0.1.5.dist-info → intellif_aihub-0.1.6.dist-info}/licenses/LICENSE +0 -0
- {intellif_aihub-0.1.5.dist-info → intellif_aihub-0.1.6.dist-info}/top_level.txt +0 -0
aihub/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.1.
|
|
1
|
+
__version__ = "0.1.6"
|
aihub/client.py
CHANGED
|
@@ -6,45 +6,64 @@ import httpx
|
|
|
6
6
|
|
|
7
7
|
from .exceptions import APIError
|
|
8
8
|
from .services import artifact
|
|
9
|
+
from .services import data_warehouse
|
|
9
10
|
from .services import dataset_management
|
|
10
11
|
from .services import document_center
|
|
12
|
+
from .services import eval
|
|
11
13
|
from .services import labelfree
|
|
14
|
+
from .services import model_center
|
|
12
15
|
from .services import model_training_platform
|
|
13
16
|
from .services import quota_schedule_management
|
|
14
17
|
from .services import tag_resource_management
|
|
15
18
|
from .services import task_center
|
|
16
19
|
from .services import user_system
|
|
20
|
+
from .services import workflow_center
|
|
17
21
|
from .services.artifact import ArtifactService
|
|
22
|
+
from .services.data_warehouse import DataWarehouseService
|
|
18
23
|
from .services.dataset_management import DatasetManagementService
|
|
19
24
|
from .services.document_center import DocumentCenterService
|
|
25
|
+
from .services.eval import EvalService
|
|
20
26
|
from .services.labelfree import LabelfreeService
|
|
27
|
+
from .services.model_center import ModelCenterService
|
|
21
28
|
from .services.model_training_platform import ModelTrainingPlatformService
|
|
22
29
|
from .services.quota_schedule_management import QuotaScheduleManagementService
|
|
23
30
|
from .services.tag_resource_management import TagResourceManagementService
|
|
24
31
|
from .services.task_center import TaskCenterService
|
|
25
32
|
from .services.user_system import UserSystemService
|
|
33
|
+
from .services.workflow_center import WorkflowCenterService
|
|
26
34
|
|
|
27
35
|
|
|
28
36
|
class Client:
|
|
29
37
|
"""AI-HUB python SDK 客户端
|
|
30
38
|
|
|
31
39
|
Attributes:
|
|
40
|
+
artifact (ArtifactService): 制品管理服务
|
|
41
|
+
data_warehouse (DataWarehouseService): 数据仓库服务
|
|
32
42
|
dataset_management (DatasetManagementService): 数据集管理服务
|
|
43
|
+
document_center (DocumentCenterService): 文档中心服务
|
|
44
|
+
eval (EvalService): 评测服务
|
|
33
45
|
labelfree (LabelfreeService): 标注服务
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
46
|
+
model_center (ModelCenterService): 模型中心服务
|
|
47
|
+
model_training_platform (ModelTrainingPlatformService): 模型训练服务
|
|
48
|
+
quota_schedule_management (QuotaScheduleManagementService): 配额调度服务
|
|
49
|
+
tag_resource_management (TagResourceManagementService): 标签管理服务
|
|
50
|
+
task_center (TaskCenterService): 任务中心服务
|
|
51
|
+
workflow_center (WorkflowCenterService): 工作流服务
|
|
37
52
|
"""
|
|
38
53
|
|
|
54
|
+
artifact: ArtifactService = None
|
|
55
|
+
data_warehouse: DataWarehouseService = None
|
|
56
|
+
dataset_management: DatasetManagementService = None
|
|
57
|
+
document_center: DocumentCenterService = None
|
|
58
|
+
eval: EvalService = None
|
|
39
59
|
labelfree: LabelfreeService = None
|
|
60
|
+
model_center: ModelCenterService = None
|
|
61
|
+
model_training_platform: ModelTrainingPlatformService = None
|
|
62
|
+
quota_schedule_management: QuotaScheduleManagementService = None
|
|
40
63
|
tag_resource_management: TagResourceManagementService = None
|
|
41
|
-
document_center: DocumentCenterService = None
|
|
42
64
|
task_center: TaskCenterService = None
|
|
43
|
-
dataset_management: DatasetManagementService = None
|
|
44
|
-
artifact: ArtifactService = None
|
|
45
65
|
user_system: UserSystemService = None
|
|
46
|
-
|
|
47
|
-
quota_schedule_management: QuotaScheduleManagementService = None
|
|
66
|
+
workflow_center: WorkflowCenterService = None
|
|
48
67
|
|
|
49
68
|
def __init__(self, *, base_url: str, token: str | None = None, timeout: float = 60.0):
|
|
50
69
|
"""AI-HUB python SDK 客户端
|
|
@@ -71,15 +90,19 @@ class Client:
|
|
|
71
90
|
headers={"Authorization": f"Bearer {token}"},
|
|
72
91
|
# event_hooks={"response": [self._raise_for_status]},
|
|
73
92
|
)
|
|
93
|
+
self.artifact = artifact.ArtifactService(self._http)
|
|
94
|
+
self.data_warehouse = data_warehouse.DataWarehouseService(self._http)
|
|
74
95
|
self.dataset_management = dataset_management.DatasetManagementService(self._http)
|
|
96
|
+
self.document_center = document_center.DocumentCenterService(self._http)
|
|
97
|
+
self.eval = eval.EvalService(self._http)
|
|
75
98
|
self.labelfree = labelfree.LabelfreeService(self._http)
|
|
99
|
+
self.model_center = model_center.ModelCenterService(self._http)
|
|
100
|
+
self.model_training_platform = model_training_platform.ModelTrainingPlatformService(self._http)
|
|
101
|
+
self.quota_schedule_management = quota_schedule_management.QuotaScheduleManagementService(self._http)
|
|
76
102
|
self.tag_resource_management = tag_resource_management.TagResourceManagementService(self._http)
|
|
77
|
-
self.document_center = document_center.DocumentCenterService(self._http)
|
|
78
103
|
self.task_center = task_center.TaskCenterService(self._http)
|
|
79
|
-
self.artifact = artifact.ArtifactService(self._http)
|
|
80
104
|
self.user_system = user_system.UserSystemService(self._http)
|
|
81
|
-
self.
|
|
82
|
-
self.quota_schedule_management = quota_schedule_management.QuotaScheduleManagementService(self._http)
|
|
105
|
+
self.workflow_center = workflow_center.WorkflowCenterService(self._http)
|
|
83
106
|
|
|
84
107
|
@staticmethod
|
|
85
108
|
def _raise_for_status(r: httpx.Response):
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from enum import IntEnum
|
|
4
|
+
from typing import List, Optional
|
|
5
|
+
|
|
6
|
+
from pydantic import BaseModel, Field
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class SearchType(IntEnum):
|
|
10
|
+
"""搜索类型"""
|
|
11
|
+
SQL = 1 # SQL
|
|
12
|
+
IMAGE = 2 # 图片
|
|
13
|
+
TEXT = 3 # 文本
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class SearchStatus(IntEnum):
|
|
17
|
+
"""搜索任务状态"""
|
|
18
|
+
WAITING = 1 # 等待中
|
|
19
|
+
RUNNING = 2 # 运行中
|
|
20
|
+
SUCCESS = 3 # 成功
|
|
21
|
+
FAIL = 4 # 失败
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class Image(BaseModel):
|
|
25
|
+
"""检索图片对象"""
|
|
26
|
+
url: str = Field(alias="url", description="URL")
|
|
27
|
+
box: Optional[List[int]] = Field(default_factory=list, description="检测框坐标 [x1, y1, x2, y2]")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class SearchResult(BaseModel):
|
|
31
|
+
"""单条检索结果"""
|
|
32
|
+
image_url: str = Field(alias="image_url", description="图片URL")
|
|
33
|
+
label: str = Field(description="标签")
|
|
34
|
+
box: List[int] = Field(description="检测框坐标 [x1, y1, x2, y2]")
|
|
35
|
+
score: float = Field(description="分数")
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class Search(BaseModel):
|
|
39
|
+
"""搜索任务完整信息"""
|
|
40
|
+
id: int = Field(description="任务ID")
|
|
41
|
+
type: SearchType = Field(description="搜索类型")
|
|
42
|
+
name: str = Field(description="任务名称")
|
|
43
|
+
description: str = Field(description="任务描述")
|
|
44
|
+
sql: str = Field(description="SQL语句")
|
|
45
|
+
feature_lib_id: int = Field(alias="feature_lib_id", description="特征库ID")
|
|
46
|
+
feature_lib_name: str = Field(alias="feature_lib_name", description="特征库名称")
|
|
47
|
+
images: Optional[List[Image]] = Field(default_factory=list, description="搜索图片列表")
|
|
48
|
+
keywords: str = Field(description="关键词")
|
|
49
|
+
top_k: int = Field(alias="top_k", description="返回前K个候选")
|
|
50
|
+
status: SearchStatus = Field(description="任务状态")
|
|
51
|
+
message: str = Field(description="信息")
|
|
52
|
+
result_url: str = Field(alias="result_url", description="结果地址")
|
|
53
|
+
results: Optional[List[SearchResult]] = Field(default_factory=list, description="检索结果列表")
|
|
54
|
+
created_at: int = Field(alias="created_at", description="创建时间戳 (ms)")
|
|
55
|
+
username: str = Field(description="创建人用户名")
|
|
56
|
+
|
|
57
|
+
model_config = {"use_enum_values": True}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class ListSearchRequest(BaseModel):
|
|
61
|
+
"""分页搜索任务请求"""
|
|
62
|
+
page_size: int = Field(20, alias="page_size", description="每页数量")
|
|
63
|
+
page_num: int = Field(1, alias="page_num", description="当前页码,从1开始")
|
|
64
|
+
name: Optional[str] = Field(None, description="名称过滤")
|
|
65
|
+
status: Optional[SearchStatus] = Field(None, description="状态过滤")
|
|
66
|
+
user_id: Optional[int] = Field(None, alias="user_id", description="用户ID过滤")
|
|
67
|
+
|
|
68
|
+
model_config = {"use_enum_values": True}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class ListSearchResponse(BaseModel):
|
|
72
|
+
"""分页搜索任务返回"""
|
|
73
|
+
total: int = Field(description="总条数")
|
|
74
|
+
page_size: int = Field(alias="page_size", description="每页数量")
|
|
75
|
+
page_num: int = Field(alias="page_num", description="当前页码")
|
|
76
|
+
data: Optional[List[Search]] = Field(default_factory=list, description="搜索任务列表")
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class CreateSearchRequest(BaseModel):
|
|
80
|
+
"""创建搜索任务请求"""
|
|
81
|
+
type: SearchType = Field(description="搜索类型")
|
|
82
|
+
name: str = Field(description="名称")
|
|
83
|
+
description: Optional[str] = Field(None, description="描述")
|
|
84
|
+
sql: Optional[str] = Field(None, description="SQL语句")
|
|
85
|
+
feature_lib_id: Optional[int] = Field(None, alias="feature_lib_id", description="特征库ID")
|
|
86
|
+
images: Optional[List[Image]] = Field(default_factory=list, description="搜索图片列表")
|
|
87
|
+
keywords: Optional[str] = Field(None, description="关键词")
|
|
88
|
+
top_k: Optional[int] = Field(None, alias="top_k", description="返回前K条")
|
|
89
|
+
|
|
90
|
+
model_config = {"use_enum_values": True}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
class CreateSearchResponse(BaseModel):
|
|
94
|
+
"""创建搜索任务返回"""
|
|
95
|
+
id: int = Field(description="任务ID")
|
|
@@ -1,99 +1,137 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
from enum import IntEnum
|
|
3
4
|
from typing import List, Optional
|
|
4
5
|
|
|
5
6
|
from pydantic import BaseModel, Field
|
|
6
7
|
|
|
7
8
|
|
|
9
|
+
class DatasetVersionStatus(IntEnum):
|
|
10
|
+
"""数据集版本状态"""
|
|
11
|
+
Waiting = 1 # 等待中
|
|
12
|
+
Running = 2 # 运行中
|
|
13
|
+
Success = 3 # 成功
|
|
14
|
+
Fail = 4 # 失败
|
|
15
|
+
MetaDB = 5 # 加载meta
|
|
16
|
+
BuildIndex = 6 # 构建index
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class UploadType(IntEnum):
|
|
20
|
+
"""上传类型"""
|
|
21
|
+
LOCAL = 1 # 本地上传
|
|
22
|
+
SERVER_PATH = 3 # 服务器路径上传
|
|
23
|
+
LABELFREE = 4 # Labelfree
|
|
24
|
+
DATA_INGEST = 5 # 数据接入
|
|
25
|
+
|
|
26
|
+
|
|
8
27
|
class CreateDatasetRequest(BaseModel):
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
28
|
+
"""创建数据集请求"""
|
|
29
|
+
name: str = Field(description="数据集名称")
|
|
30
|
+
description: str = Field(description="数据集描述")
|
|
31
|
+
tags: List[int] = Field(description="标签ID列表")
|
|
32
|
+
cover_img: Optional[str] = Field(None, alias="cover_img", description="封面图片URL")
|
|
33
|
+
create_by: Optional[int] = Field(None, alias="create_by", description="创建人")
|
|
34
|
+
is_private: Optional[bool] = Field(None, alias="is_private", description="是否私有")
|
|
35
|
+
access_user_ids: Optional[List[int]] = Field(None, alias="access_user_ids", description="具有访问权限的用户ID列表")
|
|
16
36
|
|
|
17
37
|
|
|
18
38
|
class CreateDatasetResponse(BaseModel):
|
|
19
|
-
|
|
39
|
+
"""创建数据集返回"""
|
|
40
|
+
id: int = Field(alias="id", description="数据集ID")
|
|
20
41
|
|
|
21
42
|
|
|
22
43
|
class DatasetVersionBase(BaseModel):
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
44
|
+
"""数据集版本概要"""
|
|
45
|
+
id: int = Field(description="版本ID")
|
|
46
|
+
version: int = Field(description="版本号")
|
|
47
|
+
status: DatasetVersionStatus = Field(description="版本状态")
|
|
48
|
+
parquet_index_path: Optional[str] = Field(None, alias="parquet_index_path", description="parquet索引文件路径")
|
|
49
|
+
data_count: int = Field(alias="data_count", description="数量")
|
|
50
|
+
|
|
51
|
+
model_config = {"use_enum_values": True}
|
|
28
52
|
|
|
29
53
|
|
|
30
54
|
class DatasetDetail(BaseModel):
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
55
|
+
"""数据集详情"""
|
|
56
|
+
id: int = Field(description="数据集 ID")
|
|
57
|
+
name: str = Field(description="名称")
|
|
58
|
+
description: str = Field(description="描述")
|
|
59
|
+
cover_img: Optional[str] = Field(None, alias="cover_img", description="封面图片URL")
|
|
60
|
+
created_at: int = Field(alias="created_at", description="创建时间戳 (ms)")
|
|
61
|
+
updated_at: int = Field(alias="update_at", description="更新时间戳 (ms)")
|
|
62
|
+
user_id: int = Field(alias="user_id", description="创建人ID")
|
|
63
|
+
username: str = Field(description="创建人用户名")
|
|
64
|
+
tags: List[int] = Field(description="标签ID列表")
|
|
65
|
+
access_user_ids: Optional[List[int]] = Field(None, alias="access_user_ids", description="可访问的用户ID列表")
|
|
66
|
+
is_private: Optional[bool] = Field(None, alias="is_private", description="是否私有")
|
|
67
|
+
versions: List[DatasetVersionBase] = Field(description="版本列表")
|
|
43
68
|
|
|
44
69
|
|
|
45
70
|
class ExtInfo(BaseModel):
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
71
|
+
"""扩展信息"""
|
|
72
|
+
rec_file_path: Optional[str] = Field(None, alias="rec_file_path", description="rec文件路径")
|
|
73
|
+
idx_file_path: Optional[str] = Field(None, alias="idx_file_path", description="idx文件路径")
|
|
74
|
+
json_file_path: Optional[str] = Field(None, alias="json_file_path", description="json文件路径")
|
|
75
|
+
image_dir_path: Optional[str] = Field(None, alias="image_dir_path", description="图片目录路径")
|
|
50
76
|
|
|
51
77
|
|
|
52
78
|
class CreateDatasetVersionRequest(BaseModel):
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
79
|
+
"""创建版本请求"""
|
|
80
|
+
upload_path: str = Field(alias="upload_path", description="上传路径")
|
|
81
|
+
description: Optional[str] = Field(None, description="版本描述")
|
|
82
|
+
dataset_id: int = Field(alias="dataset_id", description="数据集ID")
|
|
83
|
+
object_cnt: Optional[int] = Field(None, alias="object_cnt", description="对象数")
|
|
84
|
+
data_size: Optional[int] = Field(None, alias="data_size", description="数据大小")
|
|
85
|
+
create_by: Optional[int] = Field(None, alias="create_by", description="创建人")
|
|
86
|
+
upload_type: Optional[UploadType] = Field(alias="upload_type", description="上传类型")
|
|
87
|
+
ext_info: Optional[ExtInfo] = Field(None, alias="ext_info", description="扩展文件信息")
|
|
88
|
+
|
|
89
|
+
model_config = {"use_enum_values": True}
|
|
61
90
|
|
|
62
91
|
|
|
63
92
|
class CreateDatasetVersionResponse(BaseModel):
|
|
64
|
-
|
|
93
|
+
"""创建版本返回"""
|
|
94
|
+
id: int = Field(alias="id", description="版本ID")
|
|
65
95
|
|
|
66
96
|
|
|
67
97
|
class UploadDatasetVersionRequest(BaseModel):
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
98
|
+
"""上传数据集版本请求"""
|
|
99
|
+
upload_path: str = Field(alias="upload_path", description="上传目录")
|
|
100
|
+
upload_type: UploadType = Field(alias="upload_type", description="上传类型")
|
|
101
|
+
dataset_id: int = Field(alias="dataset_id", description="数据集ID")
|
|
102
|
+
parent_version_id: Optional[int] = Field(None, alias="parent_version_id", description="父版本ID")
|
|
103
|
+
description: Optional[str] = Field(None, alias="description", description="版本描述")
|
|
104
|
+
|
|
105
|
+
model_config = {"use_enum_values": True}
|
|
73
106
|
|
|
74
107
|
|
|
75
108
|
class UploadDatasetVersionResponse(BaseModel):
|
|
76
|
-
|
|
109
|
+
"""上传数据集版本返回"""
|
|
110
|
+
id: int = Field(alias="id", description="版本ID")
|
|
77
111
|
|
|
78
112
|
|
|
79
113
|
class DatasetVersionDetail(BaseModel):
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
114
|
+
"""数据集版本详情"""
|
|
115
|
+
id: int = Field(description="版本ID")
|
|
116
|
+
version: int = Field(description="版本号")
|
|
117
|
+
dataset_id: int = Field(alias="dataset_id", description="数据集ID")
|
|
118
|
+
upload_path: str = Field(alias="upload_path", description="上传路径")
|
|
119
|
+
upload_type: UploadType = Field(alias="upload_type", description="上传类型")
|
|
120
|
+
parent_version_id: Optional[int] = Field(None, alias="parent_version_id", description="父版本ID")
|
|
121
|
+
description: Optional[str] = Field(None, description="版本描述")
|
|
122
|
+
status: DatasetVersionStatus = Field(description="状态")
|
|
123
|
+
message: Optional[str] = Field(None, description="信息")
|
|
124
|
+
created_at: int = Field(alias="created_at", description="创建时间戳 (ms)")
|
|
125
|
+
user_id: int = Field(alias="user_id", description="创建人ID")
|
|
126
|
+
data_size: Optional[int] = Field(None, alias="data_size", description="数据大小")
|
|
127
|
+
data_count: Optional[int] = Field(None, alias="data_count", description="条数")
|
|
128
|
+
parquet_index_path: Optional[str] = Field(None, alias="parquet_index_path", description="parquet索引文件路径")
|
|
129
|
+
ext_info: Optional[ExtInfo] = Field(None, alias="ext_info", description="扩展信息")
|
|
130
|
+
|
|
131
|
+
model_config = {"use_enum_values": True}
|
|
95
132
|
|
|
96
133
|
|
|
97
134
|
class FileUploadData(BaseModel):
|
|
98
|
-
|
|
99
|
-
|
|
135
|
+
"""文件上传数据"""
|
|
136
|
+
path: str = Field(description="路径")
|
|
137
|
+
url: str = Field(description="URL")
|
aihub/models/document_center.py
CHANGED
|
@@ -1,28 +1,36 @@
|
|
|
1
|
-
# !/usr/bin/env python
|
|
2
|
-
# -*-coding:utf-8 -*-
|
|
3
|
-
|
|
4
1
|
from __future__ import annotations
|
|
5
2
|
|
|
3
|
+
from enum import IntEnum
|
|
6
4
|
from typing import List, Optional, Any
|
|
7
5
|
|
|
8
|
-
from pydantic import BaseModel
|
|
6
|
+
from pydantic import BaseModel, Field
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class DocumentType(IntEnum):
|
|
10
|
+
"""文档类型"""
|
|
11
|
+
MARKDOWN = 0 # Markdown
|
|
12
|
+
PDF = 1 # 飞书文档生成的pdf
|
|
9
13
|
|
|
10
14
|
|
|
11
15
|
class Document(BaseModel):
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
"""文档"""
|
|
17
|
+
id: int = Field(description="文档ID")
|
|
18
|
+
title: str = Field(description="标题")
|
|
19
|
+
type: DocumentType = Field(description="文档类型")
|
|
20
|
+
edit_time: int = Field(alias="edit_time", description="编辑时间")
|
|
21
|
+
need_update: bool = Field(alias="need_update", description="是否需要更新")
|
|
22
|
+
content: str = Field(description="内容")
|
|
23
|
+
username: str = Field(description="用户名")
|
|
24
|
+
user_id: int = Field(alias="user_id", description="作者ID")
|
|
25
|
+
created_at: int = Field(alias="created_at", description="创建时间戳 (ms)")
|
|
26
|
+
comments: Optional[Any] = Field(None, description="评论")
|
|
27
|
+
|
|
28
|
+
model_config = {"use_enum_values": True}
|
|
22
29
|
|
|
23
30
|
|
|
24
31
|
class GetDocumentsResponse(BaseModel):
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
"""分页文档返回"""
|
|
33
|
+
total: int = Field(description="总条数")
|
|
34
|
+
page_size: int = Field(alias="page_size", description="每页数量")
|
|
35
|
+
page_num: int = Field(alias="page_num", description="当前页码")
|
|
36
|
+
data: List[Document] = Field(description="文档列表")
|
aihub/models/eval.py
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
# !/usr/bin/env python
|
|
2
2
|
# -*-coding:utf-8 -*-
|
|
3
|
-
from
|
|
3
|
+
from typing import Dict
|
|
4
4
|
|
|
5
|
+
from pydantic import BaseModel, Field
|
|
5
6
|
|
|
6
|
-
class CreatEvalReq(BaseModel):
|
|
7
|
-
dataset_id: int
|
|
8
|
-
dataset_version_id: int
|
|
9
|
-
prediction_artifact_path: str
|
|
10
|
-
evaled_artifact_path: str
|
|
11
|
-
run_id: str
|
|
12
|
-
user_id: int = 0
|
|
13
|
-
report: dict = {}
|
|
14
7
|
|
|
8
|
+
class CreateEvalReq(BaseModel):
|
|
9
|
+
"""创建评测任务"""
|
|
10
|
+
dataset_id: int = Field(description="数据集ID")
|
|
11
|
+
dataset_version_id: int = Field(description="数据集版本ID")
|
|
12
|
+
prediction_artifact_path: str = Field(description="推理产物的路径")
|
|
13
|
+
evaled_artifact_path: str = Field(description="评测结果产物的路径")
|
|
14
|
+
run_id: str = Field(description="运行ID")
|
|
15
|
+
user_id: int = Field(0, description="用户ID")
|
|
16
|
+
report: Dict = Field(default_factory=dict, description="评测报告")
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
|
|
19
|
+
class EvalRun(BaseModel):
|
|
20
|
+
"""评测任务的运行实体"""
|
|
21
|
+
id: int = Field(description="评测的运行ID")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class CreateEvalResp(BaseModel):
|
|
25
|
+
"""创建评测任务的返回结果"""
|
|
26
|
+
eval_run: EvalRun = Field(alias="eval_run", description="评测运行信息")
|
aihub/models/labelfree.py
CHANGED
|
@@ -7,47 +7,21 @@ from pydantic import BaseModel, Field
|
|
|
7
7
|
|
|
8
8
|
class Stats(BaseModel):
|
|
9
9
|
"""标注统计信息"""
|
|
10
|
-
|
|
11
10
|
total_annotations: int = Field(alias="total_annotations", description="总数据量")
|
|
12
|
-
labeled_annotations: int = Field(
|
|
13
|
-
alias="labeled_annotations", description="已标注数据量"
|
|
14
|
-
)
|
|
11
|
+
labeled_annotations: int = Field(alias="labeled_annotations", description="已标注数据量")
|
|
15
12
|
total_labels: int = Field(alias="total_labels", description="总标签量")
|
|
16
|
-
total_reviews: Optional[int] = Field(
|
|
17
|
-
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
)
|
|
22
|
-
labeled_reviews: Optional[int] = Field(
|
|
23
|
-
None, alias="labeled_reviews", description="已质检量"
|
|
24
|
-
)
|
|
25
|
-
accepted_count: Optional[int] = Field(
|
|
26
|
-
None, alias="accepted_count", description="质检通过量"
|
|
27
|
-
)
|
|
28
|
-
rejected_count: Optional[int] = Field(
|
|
29
|
-
None, alias="rejected_count", description="质检打回量"
|
|
30
|
-
)
|
|
13
|
+
total_reviews: Optional[int] = Field(None, alias="total_reviews", description="总质检量")
|
|
14
|
+
unlabeled_reviews: Optional[int] = Field(None, alias="unlabeled_reviews", description="未质检量")
|
|
15
|
+
labeled_reviews: Optional[int] = Field(None, alias="labeled_reviews", description="已质检量")
|
|
16
|
+
accepted_count: Optional[int] = Field(None, alias="accepted_count", description="质检通过量")
|
|
17
|
+
rejected_count: Optional[int] = Field(None, alias="rejected_count", description="质检打回量")
|
|
31
18
|
|
|
32
19
|
|
|
33
20
|
class GetGlobalStatsResponse(BaseModel):
|
|
34
|
-
"""
|
|
35
|
-
标注统计概况
|
|
36
|
-
"""
|
|
37
|
-
|
|
21
|
+
"""标注统计概况"""
|
|
38
22
|
global_stats: Stats = Field(alias="global_stats")
|
|
39
|
-
valid_ten_percent: bool = Field(
|
|
40
|
-
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
)
|
|
45
|
-
valid_hundred_percent: bool = Field(
|
|
46
|
-
alias="valid_hundred_percent", description="是否完成验收100%"
|
|
47
|
-
)
|
|
48
|
-
data_exported_count: int = Field(
|
|
49
|
-
alias="data_exported_count", description="已导出数据次数"
|
|
50
|
-
)
|
|
51
|
-
exported_dataset_name: str = Field(
|
|
52
|
-
alias="exported_dataset_name", description="最新数据集名称"
|
|
53
|
-
)
|
|
23
|
+
valid_ten_percent: bool = Field(alias="valid_ten_percent", description="是否完成验收10%")
|
|
24
|
+
valid_fifty_percent: bool = Field(alias="valid_fifty_percent", description="是否完成验收50%")
|
|
25
|
+
valid_hundred_percent: bool = Field(alias="valid_hundred_percent", description="是否完成验收100%")
|
|
26
|
+
data_exported_count: int = Field(alias="data_exported_count", description="已导出数据次数")
|
|
27
|
+
exported_dataset_name: str = Field(alias="exported_dataset_name", description="最新数据集名称")
|