1
1
"""Client presentation methods for projects."""
2
-
3
2
import warnings
4
3
from typing import (
5
4
Any ,
16
15
from typeguard import typechecked
17
16
18
17
from kili .adapters .kili_api_gateway .helpers .queries import QueryOptions
19
- from kili .core .enums import ProjectType
18
+ from kili .core .enums import DemoProjectType , ProjectType
20
19
from kili .domain .project import ComplianceTag , InputType , ProjectFilters , ProjectId
21
20
from kili .domain .tag import TagId
22
21
from kili .domain .types import ListOrTuple
22
+ from kili .exceptions import IncompatibleArgumentsError
23
23
from kili .presentation .client .helpers .common_validators import (
24
24
disable_tqdm_if_as_generator ,
25
25
)
@@ -46,6 +46,7 @@ def create_project(
46
46
project_type : Optional [ProjectType ] = None ,
47
47
tags : Optional [ListOrTuple [str ]] = None ,
48
48
compliance_tags : Optional [ListOrTuple [ComplianceTag ]] = None ,
49
+ from_demo_project : Optional [DemoProjectType ] = None ,
49
50
) -> Dict [Literal ["id" ], str ]:
50
51
"""Create a project.
51
52
@@ -55,34 +56,31 @@ def create_project(
55
56
title: Title of the project.
56
57
description: Description of the project.
57
58
project_id: Identifier of the project to copy.
58
- project_type: Currently, one of:
59
-
60
- - `IMAGE_CLASSIFICATION_MULTI`
61
- - `IMAGE_CLASSIFICATION_SINGLE`
62
- - `IMAGE_OBJECT_DETECTION_POLYGON`
63
- - `IMAGE_OBJECT_DETECTION_RECTANGLE`
64
- - `IMAGE_OBJECT_DETECTION_SEMANTIC`
65
- - `IMAGE_POSE_ESTIMATION`
66
- - `OCR`
67
- - `PDF_CLASSIFICATION_MULTI`
68
- - `PDF_CLASSIFICATION_SINGLE`
69
- - `PDF_NAMED_ENTITY_RECOGNITION`
70
- - `PDF_OBJECT_DETECTION_RECTANGLE`
71
- - `SPEECH_TO_TEXT`
72
- - `TEXT_CLASSIFICATION_MULTI`
73
- - `TEXT_CLASSIFICATION_SINGLE`
74
- - `TEXT_NER`
75
- - `TEXT_TRANSCRIPTION`
76
- - `TIME_SERIES`
77
- - `VIDEO_CLASSIFICATION_SINGLE`
78
- - `VIDEO_FRAME_CLASSIFICATION`
79
- - `VIDEO_FRAME_OBJECT_TRACKING`
80
-
59
+ project_type: Will be deprecated soon, use from_demo_project instead.
81
60
tags: Tags to add to the project. The tags must already exist in the organization.
82
61
compliance_tags: Compliance tags of the project.
83
62
Compliance tags are used to categorize projects based on the sensitivity of
84
63
the data being handled and the legal constraints associated with it.
85
64
Possible values are: `PHI` and `PII`.
65
+ from_demo_project: Currently, one of:
66
+
67
+ - `DEMO_COMPUTER_VISION_TUTORIAL`
68
+ - `DEMO_TEXT_TUTORIAL`
69
+ - `DEMO_PDF_TUTORIAL`
70
+ - `VIDEO_FRAME_OBJECT_TRACKING`
71
+ - `DEMO_SEGMENTATION_COCO`
72
+ - `DEMO_NER`
73
+ - `DEMO_ID_OCR`
74
+ - `DEMO_REVIEWS`
75
+ - `DEMO_OCR`
76
+ - `DEMO_NER_TWEETS`
77
+ - `DEMO_PLASTIC`
78
+ - `DEMO_CHATBOT`
79
+ - `DEMO_PDF`
80
+ - `DEMO_ANIMALS`
81
+ - `DEMO_LLM`
82
+ - `DEMO_LLM_INSTR_FOLLOWING`
83
+ - `DEMO_SEGMENTATION`
86
84
87
85
Returns:
88
86
A dict with the id of the created project.
@@ -94,6 +92,18 @@ def create_project(
94
92
For more detailed examples on how to create projects,
95
93
see [the recipe](https://docs.kili-technology.com/recipes/creating-a-project).
96
94
"""
95
+ if project_type is not None :
96
+ warnings .warn (
97
+ "Parameter project_type will be soon deprecated, please use from_demo_project instead." ,
98
+ DeprecationWarning ,
99
+ stacklevel = 1 ,
100
+ )
101
+
102
+ if project_type is not None and from_demo_project is not None :
103
+ raise IncompatibleArgumentsError (
104
+ "Either provide project_type or from_demo_project. Not both at the same time."
105
+ )
106
+
97
107
project_id = ProjectUseCases (self .kili_api_gateway ).create_project (
98
108
input_type = input_type ,
99
109
json_interface = json_interface ,
@@ -102,6 +112,7 @@ def create_project(
102
112
project_id = project_id ,
103
113
project_type = project_type ,
104
114
compliance_tags = compliance_tags ,
115
+ from_demo_project = from_demo_project ,
105
116
)
106
117
107
118
if tags is not None :
0 commit comments