@@ -1131,35 +1131,40 @@ def create_project(
11311131 workflows : Any = None ,
11321132 instructions_link : str = None ,
11331133 workflow : str = None ,
1134+ form : dict = None ,
11341135 ):
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.
11361138
1137- :param project_name: the new project's name
1139+ :param project_name: The new project's name.
11381140 :type project_name: str
11391141
1140- :param project_description: the new project's description
1142+ :param project_description: The new project's description.
11411143 :type project_description: str
11421144
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' .
11441146 :type project_type: str
11451147
11461148 :param settings: list of settings objects
11471149 :type settings: list of dicts
11481150
1149- :param classes: list of class objects
1151+ :param classes: List of class objects. Not allowed for 'Multimodal' projects.
11501152 :type classes: list of dicts
11511153
1152- :param workflows: Deprecated
1154+ :param workflows: Deprecated. Do not use.
11531155 :type workflows: list of dicts
11541156
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.
11571158 :type workflow: str
11581159
1159- :param instructions_link: str of instructions URL
1160+ :param instructions_link: URL for project instructions.
11601161 :type instructions_link: str
11611162
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.
11631168 :rtype: dict
11641169 """
11651170 if workflows is not None :
@@ -1172,6 +1177,16 @@ def create_project(
11721177 settings = parse_obj_as (List [SettingEntity ], settings )
11731178 else :
11741179 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 ))
11751190 if classes :
11761191 classes = parse_obj_as (List [AnnotationClassEntity ], classes )
11771192 project_entity = entities .ProjectEntity (
@@ -1194,6 +1209,13 @@ def create_project(
11941209 project_response = self .controller .projects .create (project_entity )
11951210 project_response .raise_for_status ()
11961211 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
11971219 if classes :
11981220 classes_response = self .controller .annotation_classes .create_multiple (
11991221 project , classes
@@ -2392,6 +2414,9 @@ def upload_videos_from_folder_to_project(
23922414 """Uploads image frames from all videos with given extensions from folder_path to the project.
23932415 Sets status of all the uploaded images to set_status if it is not None.
23942416
2417+ .. note::
2418+ Only works on Image projects.
2419+
23952420 :param project: project name or folder path (e.g., "project1/folder1")
23962421 :type project: str
23972422
@@ -2486,6 +2511,9 @@ def upload_video_to_project(
24862511 """Uploads image frames from video to platform. Uploaded images will have
24872512 names "<video_name>_<frame_no>.jpg".
24882513
2514+ .. note::
2515+ Only works on Image projects.
2516+
24892517 :param project: project name or folder path (e.g., "project1/folder1")
24902518 :type project: str
24912519
0 commit comments