@@ -1131,35 +1131,40 @@ def create_project(
1131
1131
workflows : Any = None ,
1132
1132
instructions_link : str = None ,
1133
1133
workflow : str = None ,
1134
+ form : dict = None ,
1134
1135
):
1135
- """Create a new project in the team.
1136
+ """Creates a new project in the team. For Multimodal projects, you must provide a valid form object,
1137
+ which serves as a template determining the layout and behavior of the project's interface.
1136
1138
1137
- :param project_name: the new project's name
1139
+ :param project_name: The new project's name.
1138
1140
:type project_name: str
1139
1141
1140
- :param project_description: the new project's description
1142
+ :param project_description: The new project's description.
1141
1143
:type project_description: str
1142
1144
1143
- :param project_type: the new project type, Vector, Pixel, Video, Document, Tiled, PointCloud, Multimodal.
1145
+ :param project_type: The project type. Supported types: ' Vector', ' Pixel', ' Video', ' Document', ' Tiled', ' PointCloud', ' Multimodal' .
1144
1146
:type project_type: str
1145
1147
1146
1148
:param settings: list of settings objects
1147
1149
:type settings: list of dicts
1148
1150
1149
- :param classes: list of class objects
1151
+ :param classes: List of class objects. Not allowed for 'Multimodal' projects.
1150
1152
:type classes: list of dicts
1151
1153
1152
- :param workflows: Deprecated
1154
+ :param workflows: Deprecated. Do not use.
1153
1155
:type workflows: list of dicts
1154
1156
1155
- :param workflow: the name of the workflow already created within the team, which must match exactly.
1156
- If None, the default “System workflow” workflow will be set.
1157
+ :param workflow: Name of the workflow already created within the team (must match exactly). If None, the default "System workflow" will be used.
1157
1158
:type workflow: str
1158
1159
1159
- :param instructions_link: str of instructions URL
1160
+ :param instructions_link: URL for project instructions.
1160
1161
:type instructions_link: str
1161
1162
1162
- :return: dict object metadata the new project
1163
+ :param form: Required for Multimodal projects. Must be a JSON object that conforms to SuperAnnotate’s schema
1164
+ for Multimodal form templates, as used in the Multimodal Form Editor.
1165
+ :type form: dict
1166
+
1167
+ :return: Metadata of the newly created project.
1163
1168
:rtype: dict
1164
1169
"""
1165
1170
if workflows is not None :
@@ -1172,6 +1177,16 @@ def create_project(
1172
1177
settings = parse_obj_as (List [SettingEntity ], settings )
1173
1178
else :
1174
1179
settings = []
1180
+ if ProjectType (project_type ) == ProjectType .MULTIMODAL :
1181
+ if not form :
1182
+ raise AppException (
1183
+ "A form object is required when creating a Multimodal project."
1184
+ )
1185
+ if classes is not None :
1186
+ raise AppException (
1187
+ "Classes cannot be provided for Multimodal projects."
1188
+ )
1189
+ settings .append (SettingEntity (attribute = "TemplateState" , value = 1 ))
1175
1190
if classes :
1176
1191
classes = parse_obj_as (List [AnnotationClassEntity ], classes )
1177
1192
project_entity = entities .ProjectEntity (
@@ -1194,6 +1209,13 @@ def create_project(
1194
1209
project_response = self .controller .projects .create (project_entity )
1195
1210
project_response .raise_for_status ()
1196
1211
project = project_response .data
1212
+ if form :
1213
+ form_response = self .controller .projects .attach_form (project , form )
1214
+ try :
1215
+ form_response .raise_for_status ()
1216
+ except AppException :
1217
+ self .controller .projects .delete (project )
1218
+ raise
1197
1219
if classes :
1198
1220
classes_response = self .controller .annotation_classes .create_multiple (
1199
1221
project , classes
@@ -2392,6 +2414,9 @@ def upload_videos_from_folder_to_project(
2392
2414
"""Uploads image frames from all videos with given extensions from folder_path to the project.
2393
2415
Sets status of all the uploaded images to set_status if it is not None.
2394
2416
2417
+ .. note::
2418
+ Only works on Image projects.
2419
+
2395
2420
:param project: project name or folder path (e.g., "project1/folder1")
2396
2421
:type project: str
2397
2422
@@ -2486,6 +2511,9 @@ def upload_video_to_project(
2486
2511
"""Uploads image frames from video to platform. Uploaded images will have
2487
2512
names "<video_name>_<frame_no>.jpg".
2488
2513
2514
+ .. note::
2515
+ Only works on Image projects.
2516
+
2489
2517
:param project: project name or folder path (e.g., "project1/folder1")
2490
2518
:type project: str
2491
2519
0 commit comments